1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 16:02:43 +03:00

Define a function to close a term.

This commit is contained in:
Rob Rix 2019-07-18 16:08:32 -04:00
parent 8371475e43
commit a83cdffa73
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -2,6 +2,7 @@
module Data.Scope module Data.Scope
( Incr(..) ( Incr(..)
, incr , incr
, closed
, Scope(..) , Scope(..)
, fromScope , fromScope
, toScope , toScope
@ -44,6 +45,10 @@ incr :: (a -> c) -> (b -> c) -> Incr a b -> c
incr z s = \case { Z a -> z a ; S b -> s b } incr z s = \case { Z a -> z a ; S b -> s b }
closed :: Traversable f => f a -> Maybe (f b)
closed = traverse (const Nothing)
newtype Scope a f b = Scope { unScope :: f (Incr a (f b)) } newtype Scope a f b = Scope { unScope :: f (Incr a (f b)) }
deriving (Foldable, Functor, Traversable) deriving (Foldable, Functor, Traversable)