mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Spell out a bunch of type parameters in full.
This commit is contained in:
parent
ad4c929026
commit
70a2199eec
@ -6,18 +6,18 @@ import Data.Semigroup.Reducer
|
||||
import Data.Semilattice.Lower
|
||||
import Prologue
|
||||
|
||||
-- | An abstract address with a location of @l@ pointing to a variable of type @a@.
|
||||
newtype Address l a = Address { unAddress :: l }
|
||||
-- | An abstract address with a @location@ pointing to a variable of type @value@.
|
||||
newtype Address location value = Address { unAddress :: location }
|
||||
deriving (Eq, Foldable, Functor, Generic1, Ord, Show, Traversable)
|
||||
|
||||
instance Eq l => Eq1 (Address l) where liftEq = genericLiftEq
|
||||
instance Ord l => Ord1 (Address l) where liftCompare = genericLiftCompare
|
||||
instance Show l => Show1 (Address l) where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Eq location => Eq1 (Address location) where liftEq = genericLiftEq
|
||||
instance Ord location => Ord1 (Address location) where liftCompare = genericLiftCompare
|
||||
instance Show location => Show1 (Address location) where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
|
||||
class Ord loc => Location loc where
|
||||
class Ord location => Location location where
|
||||
-- | The type into which stored values will be written for a given location type.
|
||||
type family Cell loc :: * -> *
|
||||
type family Cell location :: * -> *
|
||||
|
||||
|
||||
-- | 'Precise' models precise store semantics where only the 'Latest' value is taken. Everything gets it's own address (always makes a new allocation) which makes for a larger store.
|
||||
@ -39,19 +39,19 @@ instance Location Monovariant where
|
||||
-- | A cell holding a single value. Writes will replace any prior value.
|
||||
-- This is isomorphic to 'Last' from Data.Monoid, but is more convenient
|
||||
-- because it has a 'Reducer' instance.
|
||||
newtype Latest a = Latest { unLatest :: Maybe a }
|
||||
newtype Latest value = Latest { unLatest :: Maybe value }
|
||||
deriving (Eq, Foldable, Functor, Generic1, Lower, Ord, Show, Traversable)
|
||||
|
||||
instance Semigroup (Latest a) where
|
||||
instance Semigroup (Latest value) where
|
||||
a <> Latest Nothing = a
|
||||
_ <> b = b
|
||||
|
||||
-- | 'Option' semantics rather than that of 'Maybe', which is broken.
|
||||
instance Monoid (Latest a) where
|
||||
instance Monoid (Latest value) where
|
||||
mappend = (<>)
|
||||
mempty = Latest Nothing
|
||||
|
||||
instance Reducer a (Latest a) where
|
||||
instance Reducer value (Latest value) where
|
||||
unit = Latest . Just
|
||||
|
||||
instance Eq1 Latest where liftEq = genericLiftEq
|
||||
|
Loading…
Reference in New Issue
Block a user