Skip to content

Commit

Permalink
Fix partiality of 'fillGrid'
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Jul 1, 2024
1 parent 7ef6659 commit 6051237
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/swarm-topography/Swarm/Game/Scenario/Topography/Area.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ getAreaDimensions cellGrid =
computeArea :: AreaDimensions -> Int32
computeArea (AreaDimensions w h) = w * h

-- |
-- Warning: size must be nonzero,
-- since 'stimes' is unsafe with value @0@.
fillGrid :: AreaDimensions -> a -> Grid a
fillGrid (AreaDimensions w h) =
fillGrid (AreaDimensions 0 _) _ = EmptyGrid
fillGrid (AreaDimensions _ 0) _ = EmptyGrid
fillGrid (AreaDimensions w h) x =
Grid
. stimes h
. pure
. stimes w
. pure
$ x

0 comments on commit 6051237

Please sign in to comment.