syntactic 3.8.1 → 3.8.2
raw patch · 4 files changed
+27/−11 lines, 4 filesdep ~basedep ~constraints
Dependency ranges changed: base, constraints
Files
- src/Data/NestTuple/TH.hs +11/−2
- src/Language/Syntactic/TH.hs +5/−2
- syntactic.cabal +3/−3
- tests/AlgorithmTests.hs +8/−4
src/Data/NestTuple/TH.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ module Data.NestTuple.TH where @@ -14,8 +16,15 @@ mkPairT :: Type -> Type -> Type mkPairT a b = foldl AppT (TupleT 2) [a,b] +mkTupE :: [Exp] -> Exp+#if __GLASGOW_HASKELL__ >= 810+mkTupE = TupE . map Just+#else+mkTupE = TupE+#endif+ mkPairE :: Exp -> Exp -> Exp-mkPairE a b = TupE [a,b]+mkPairE a b = mkTupE [a,b] mkPairP :: Pat -> Pat -> Pat mkPairP a b = TupP [a,b]@@ -64,7 +73,7 @@ , FunD (mkName "unnest") [ Clause [foldNest VarP mkPairP $ toNest vars]- (NormalB (TupE (map VarE vars)))+ (NormalB (mkTupE (map VarE vars))) [] ] ]
src/Language/Syntactic/TH.hs view
@@ -232,9 +232,12 @@ classPred cl con = ClassP cl #endif --- | Portable method for constructing a type synonym instances+-- | Portable method for constructing a type synonym instance tySynInst :: Name -> [Type] -> Type -> Dec-#if __GLASGOW_HASKELL__ >= 708+#if __GLASGOW_HASKELL__ >= 808+tySynInst t as rhs = TySynInstD $+ TySynEqn Nothing (foldl AppT (ConT t) as) rhs+#elif __GLASGOW_HASKELL__ >= 708 tySynInst t as rhs = TySynInstD t (TySynEqn as rhs) #else tySynInst = TySynInstD
syntactic.cabal view
@@ -1,5 +1,5 @@ Name: syntactic-Version: 3.8.1+Version: 3.8.2 Synopsis: Generic representation and manipulation of abstract syntax Description: The library provides a generic representation of type-indexed abstract syntax trees (or indexed data types in general). It also permits the definition of open syntax@@ -83,8 +83,8 @@ Language.Syntactic.Sugar.TupleTyped build-depends:- base >= 4.6 && < 4.13,- constraints < 0.11,+ base >= 4.6 && < 4.15,+ constraints < 0.13, containers < 0.7, data-hash < 0.3, deepseq < 1.5,
tests/AlgorithmTests.hs view
@@ -25,6 +25,9 @@ +subCap :: (Num a, Ord a) => a -> a -> a+subCap a b = max 0 (a - b)+ data Sym sig where Int :: Int -> Sym (Full Int)@@ -101,10 +104,11 @@ ] genExp :: Int -> [Name] -> Gen (ASTF Dom Int)+genExp s _ | s < 0 = error (show s) genExp s inScope = frequency [ (1, fmap int arbitrary) , (1, fmap varr $ genVar 1 1 inScope)- , (s, do a <- genExp (s-1) inScope+ , (s, do a <- genExp (s `subCap` 1) inScope return $ neg a ) , (s, do a <- genExp (s `div` 2) inScope@@ -131,14 +135,14 @@ genExp1 :: Int -> [Name] -> Gen (ASTF Dom (Int -> Int)) genExp1 s inScope = do v <- genVar 1 2 inScope- body <- genExp (s-1) (v:inScope)+ body <- genExp (s `subCap` 1) (v:inScope) return $ lamm v body genExp2 :: Int -> [Name] -> Gen (ASTF Dom (Int -> Int -> Int)) genExp2 s inScope = do v1 <- genVar 1 2 inScope v2 <- genVar 1 2 (v1:inScope)- body <- genExp (s-2) (v2:v1:inScope)+ body <- genExp (s `subCap` 2) (v2:v1:inScope) return $ lamm v1 $ lamm v2 body genExp3 :: Int -> [Name] -> Gen (ASTF Dom (Int -> Int -> Int -> Int))@@ -146,7 +150,7 @@ v1 <- genVar 1 2 inScope v2 <- genVar 1 2 (v1:inScope) v3 <- genVar 1 2 (v2:v1:inScope)- body <- genExp (s-3) (v3:v2:v1:inScope)+ body <- genExp (s `subCap` 3) (v3:v2:v1:inScope) return $ lamm v1 $ lamm v2 $ lamm v3 body shrinkExp :: AST Dom sig -> [AST Dom sig]