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 52c4a7c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 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,12 @@ 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 0) _ = EmptyGrid
fillGrid (AreaDimensions w h) x =
Grid
. stimes h
. pure
. stimes w
. pure
$ x

0 comments on commit 52c4a7c

Please sign in to comment.