mirror of
https://github.com/github/semantic.git
synced 2025-01-01 19:55:34 +03:00
Move the type tags to the bottom.
This commit is contained in:
parent
afe112985b
commit
4172f83842
@ -4,6 +4,14 @@ module Data.Record where
|
|||||||
import Data.Tagged
|
import Data.Tagged
|
||||||
import Prologue
|
import Prologue
|
||||||
|
|
||||||
|
data Record :: [*] -> * where
|
||||||
|
RNil :: Record '[]
|
||||||
|
RCons :: h -> Record t -> Record (h ': t)
|
||||||
|
|
||||||
|
class HasField (fields :: [*]) (field :: *) where
|
||||||
|
getField :: Record fields -> field
|
||||||
|
|
||||||
|
|
||||||
infix 9 :=>
|
infix 9 :=>
|
||||||
|
|
||||||
-- | A phantom type tag constructor.
|
-- | A phantom type tag constructor.
|
||||||
@ -14,10 +22,3 @@ type a :=> b = Tagged a b
|
|||||||
-- | This has type a :=> b. When you require a to be some concrete type (and you usually will), it should be provided by context, whether using ascription, a type signature for the binding, `asTypeOf`, or some other way to allow the specific type to be inferred.
|
-- | This has type a :=> b. When you require a to be some concrete type (and you usually will), it should be provided by context, whether using ascription, a type signature for the binding, `asTypeOf`, or some other way to allow the specific type to be inferred.
|
||||||
field :: b -> a :=> b
|
field :: b -> a :=> b
|
||||||
field = Tagged
|
field = Tagged
|
||||||
|
|
||||||
data Record :: [*] -> * where
|
|
||||||
RNil :: Record '[]
|
|
||||||
RCons :: h -> Record t -> Record (h ': t)
|
|
||||||
|
|
||||||
class HasField (fields :: [*]) (field :: *) where
|
|
||||||
getField :: Record fields -> field
|
|
||||||
|
Loading…
Reference in New Issue
Block a user