mirror of
https://github.com/github/semantic.git
synced 2024-12-20 21:31:48 +03:00
Add HasField instances for hlists.
This commit is contained in:
parent
eb91962cbb
commit
3b8c1546a5
@ -23,3 +23,12 @@ 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
|
||||
|
||||
|
||||
-- Instances
|
||||
|
||||
instance {-# OVERLAPPABLE #-} HasField fields field => HasField (notIt ': fields) field where
|
||||
getField (RCons _ t) = getField t
|
||||
|
||||
instance {-# OVERLAPPABLE #-} HasField (field ': fields) field where
|
||||
getField (RCons h _) = h
|
||||
|
Loading…
Reference in New Issue
Block a user