1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 02:14:20 +03:00

Move the type tags to the bottom.

This commit is contained in:
Rob Rix 2016-06-16 11:49:42 -04:00
parent afe112985b
commit 4172f83842

View File

@ -4,6 +4,14 @@ module Data.Record where
import Data.Tagged
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 :=>
-- | 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.
field :: b -> a :=> b
field = Tagged
data Record :: [*] -> * where
RNil :: Record '[]
RCons :: h -> Record t -> Record (h ': t)
class HasField (fields :: [*]) (field :: *) where
getField :: Record fields -> field