1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

Add a maybeGetField function over Records.

This commit is contained in:
Rob Rix 2016-07-21 17:26:03 -04:00
parent e50b1a5f61
commit 107077c493

View File

@ -19,6 +19,10 @@ infixr 0 .:
(.:) :: Typeable h => h -> Record t -> Record (h ': t)
(.:) = RCons
maybeGetField :: Typeable field => Record fields -> Maybe field
maybeGetField (RCons h t) = cast h <|> maybeGetField t
maybeGetField RNil = Nothing
-- Classes