hobbits 1.2.1 → 1.2.2
raw patch · 7 files changed
+20/−11 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.Type.RList: hlistLookup :: Member c a -> MapRList f c -> f a
+ Data.Binding.Hobbits.Liftable: instance Data.Binding.Hobbits.Liftable.Liftable ()
+ Data.Binding.Hobbits.NuMatching: instance Data.Binding.Hobbits.NuMatching.NuMatching ()
+ Data.Type.RList: mapRListLookup :: Member c a -> MapRList f c -> f a
Files
- CHANGELOG +3/−0
- Data/Binding/Hobbits/Examples/LambdaLifting.hs +4/−4
- Data/Binding/Hobbits/Examples/LambdaLifting/Terms.hs +2/−2
- Data/Binding/Hobbits/Liftable.hs +3/−0
- Data/Binding/Hobbits/NuMatching.hs +3/−0
- Data/Type/RList.hs +4/−4
- hobbits.cabal +1/−1
CHANGELOG view
@@ -1,4 +1,7 @@ +1.2.1 -> 1.2.2+- Added NuMatching and Liftable instances for the unit type+ 1.2 -> 1.2.1 - Renamed Data.Type.HList to Data.Type.RList - Now using DataKinds to represent right-lists of types
Data/Binding/Hobbits/Examples/LambdaLifting.hs view
@@ -108,12 +108,12 @@ FVUnionRet fvs f1 f2 -> case elemMC fv2 fvs of Nothing -> FVUnionRet (fvs :>: fv2) (\(xs :>: _) -> f1 xs) (\(xs :>: x) -> f2 xs :>: x)- Just idx -> FVUnionRet fvs f1 (\xs -> f2 xs :>: C.hlistLookup idx xs)+ Just idx -> FVUnionRet fvs f1 (\xs -> f2 xs :>: C.mapRListLookup idx xs) fvUnion (fvs1 :>: fv1) fvs2 = case fvUnion fvs1 fvs2 of FVUnionRet fvs f1 f2 -> case elemMC fv1 fvs of Nothing -> FVUnionRet (fvs :>: fv1) (\(xs :>: x) -> f1 xs :>: x) (\(xs :>: _) -> f2 xs)- Just idx -> FVUnionRet fvs (\xs -> f1 xs :>: C.hlistLookup idx xs) f2+ Just idx -> FVUnionRet fvs (\xs -> f1 xs :>: C.mapRListLookup idx xs) f2 elemMC :: MbLName c a -> FVList c fvs -> Maybe (Member fvs a) elemMC _ MNil = Nothing@@ -133,7 +133,7 @@ skelSubst :: STerm c a -> MapRList Name c -> DTerm a skelSubst (SWeaken f db) names = skelSubst db $ f names-skelSubst (SVar inC) names = TVar $ C.hlistLookup inC names+skelSubst (SVar inC) names = TVar $ C.mapRListLookup inC names skelSubst (SDVar dTVar) _ = TDVar dTVar skelSubst (SApp db1 db2) names = TApp (skelSubst db1 names) (skelSubst db2 names) @@ -175,7 +175,7 @@ SepRet m f -> case raiseAppName (C.mkMonoAppend c lc) n of Left idx -> SepRet m (\xs ->- f xs :>: C.hlistLookup (C.weakenMemberL (proxyOfMapRList m) idx) xs)+ f xs :>: C.mapRListLookup (C.weakenMemberL (proxyOfMapRList m) idx) xs) Right n -> SepRet (m :>: MbLName n) (\xs -> case C.splitMapRList c' lc xs of
Data/Binding/Hobbits/Examples/LambdaLifting/Terms.hs view
@@ -55,7 +55,7 @@ where pretty' :: Mb c (Term a) -> MapRList StringF c -> Int -> String pretty' [nuP| Var b |] varnames n = case mbNameBoundP b of- Left pf -> unStringF (C.hlistLookup pf varnames)+ Left pf -> unStringF (C.mapRListLookup pf varnames) Right n -> "(free-var " ++ show n ++ ")" pretty' [nuP| Lam b |] varnames n = let x = "x" ++ show n in@@ -107,7 +107,7 @@ "(" ++ mpretty b1 varnames ++ " " ++ mpretty b2 varnames ++ ")" -mprettyName (Left pf) varnames = unStringF (C.hlistLookup pf varnames)+mprettyName (Left pf) varnames = unStringF (C.mapRListLookup pf varnames) mprettyName (Right n) varnames = "(free-var " ++ (show n) ++ ")"
Data/Binding/Hobbits/Liftable.hs view
@@ -75,6 +75,9 @@ mbLift [nuP| [] |] = [] mbLift [nuP| x : xs |] = (mbLift x) : (mbLift xs) +instance Liftable () where+ mbLift [nuP| () |] = ()+ instance (Liftable a, Liftable b) => Liftable (a,b) where mbLift [nuP| (x,y) |] = (mbLift x, mbLift y)
Data/Binding/Hobbits/NuMatching.hs view
@@ -75,6 +75,9 @@ instance NuMatching Char where nuMatchingProof = MbTypeReprData (MkMbTypeReprData $ (\c1 c2 -> id)) +instance NuMatching () where+ nuMatchingProof = MbTypeReprData (MkMbTypeReprData $ (\c1 c2 -> id))+ instance (NuMatching a, NuMatching b) => NuMatching (a,b) where nuMatchingProof = MbTypeReprData (MkMbTypeReprData $ (\c1 c2 (a,b) -> (mapNames c1 c2 a, mapNames c1 c2 b)))
Data/Type/RList.hs view
@@ -127,10 +127,10 @@ singleton x = MNil :>: x -- | Look up an element of a 'MapRList' vector using a 'Member' proof.-hlistLookup :: Member c a -> MapRList f c -> f a-hlistLookup Member_Base (_ :>: x) = x-hlistLookup (Member_Step mem') (mc :>: _) = hlistLookup mem' mc---hlistLookup _ _ = error "Should not happen! (hlistLookup)"+mapRListLookup :: Member c a -> MapRList f c -> f a+mapRListLookup Member_Base (_ :>: x) = x+mapRListLookup (Member_Step mem') (mc :>: _) = mapRListLookup mem' mc+--mapRListLookup _ _ = error "Should not happen! (mapRListLookup)" -- | Map a function on all elements of a 'MapRList' vector. mapMapRList :: (forall x. f x -> g x) -> MapRList f c -> MapRList g c
hobbits.cabal view
@@ -1,5 +1,5 @@ Name: hobbits-Version: 1.2.1+Version: 1.2.2 Synopsis: A library for canonically representing terms with binding Description: A library for canonically representing terms with binding via a