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:
parent
8371475e43
commit
a83cdffa73
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user