Skip to content

Commit

Permalink
Update src/Swarm/Util/Erasable.hs
Browse files Browse the repository at this point in the history
Co-authored-by: Karl Ostmo <[email protected]>
  • Loading branch information
byorgey and kostmo authored Aug 13, 2023
1 parent 4957aec commit 2dc91ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Swarm/Util/Erasable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ module Swarm.Util.Erasable where
-- | Extend a semigroup to a monoid by adding an identity ('ENothing') /and/ an
-- annihilator ('EErase'). That is,
--
-- * `ENothing <> e = e <> ENothing = e`
-- * `EErase <> e = e <> EErase = EErase`
-- * @ENothing <> e = e <> ENothing = e@
-- * @EErase <> e = e <> EErase = EErase@
--
-- This allows us to "erase" previous values by combining with
-- 'EErase'. The 'erasableToMaybe' function turns an @Erasable@
-- into a @Maybe@ by collapsing 'ENothing' and 'EErase' both back
-- 'EErase'. The 'erasableToMaybe' function turns an 'Erasable'
-- into a 'Maybe' by collapsing 'ENothing' and 'EErase' both back
-- into 'Nothing'.
data Erasable e = ENothing | EErase | EJust e
deriving (Show, Eq, Ord, Functor)
Expand Down

0 comments on commit 2dc91ce

Please sign in to comment.