1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

ArbitraryTerm → Term eliminator.

This commit is contained in:
Rob Rix 2015-12-11 09:14:54 -05:00
parent bc47d2743f
commit fda61b074f

View File

@ -7,7 +7,7 @@ import Split
import Syntax
import Term
import Control.Comonad.Cofree
import Control.Monad.Free
import Control.Monad.Free hiding (unfold)
import qualified Data.Map as Map
import qualified Data.Set as Set
import Test.Hspec
@ -17,6 +17,10 @@ import Test.QuickCheck
newtype ArbitraryTerm a annotation = ArbitraryTerm (annotation, (Syntax a (ArbitraryTerm a annotation)))
deriving (Show, Eq)
unTerm :: ArbitraryTerm a annotation -> Term a annotation
unTerm arbitraryTerm = unfold unpack arbitraryTerm
where unpack (ArbitraryTerm (annotation, syntax)) = (annotation, syntax)
newtype ArbitrarySyntax a f = ArbitrarySyntax { unSyntax :: Syntax a f }
deriving (Show, Eq)