haskus-utils-variant 3.4 → 3.5
raw patch · 5 files changed
+16/−13 lines, 5 files
Files
- haskus-utils-variant.cabal +4/−3
- src/lib/Haskus/Utils/ContFlow.hs +1/−1
- src/lib/Haskus/Utils/EADT/TH.hs +5/−3
- src/lib/Haskus/Utils/Variant.hs +4/−4
- src/tests/EADT.hs +2/−2
haskus-utils-variant.cabal view
@@ -1,7 +1,8 @@+cabal-version: 2.4 name: haskus-utils-variant-version: 3.4+version: 3.5 synopsis: Variant and EADT-license: BSD3+license: BSD-3-Clause license-file: LICENSE author: Sylvain Henry maintainer: sylvain@haskus.fr@@ -9,7 +10,6 @@ copyright: Sylvain Henry 2020 category: System build-type: Simple-cabal-version: 1.20 description: Variant (extensible sum type) and EADT (extensible recursive sum type)@@ -18,6 +18,7 @@ source-repository head type: git location: git://github.com/haskus/packages.git+ subdir: haskus-utils-variant flag unliftio Description: Enable MonadUnliftIO instance
src/lib/Haskus/Utils/ContFlow.hs view
@@ -85,7 +85,7 @@ -- | Bind a flow to a 1-tuple of continuations (>:-:>) :: ContFlow '[a] r -> (a -> r) -> r {-# INLINABLE (>:-:>) #-}-(>:-:>) (ContFlow f) c = f (Solo c)+(>:-:>) (ContFlow f) c = f (MkSolo c) infixl 0 >:-:>
src/lib/Haskus/Utils/EADT/TH.hs view
@@ -201,10 +201,12 @@ , v == e = AppT (AppT ArrowT eadtTy) (go b) | otherwise = AppT (AppT ArrowT a) (go b) #if MIN_VERSION_base(4,15,0)- go (AppT (AppT (AppT MulArrowT m) a) b)+ go (AppT (AppT (AppT MulArrowT _m) a) b) | VarT v <- a- , v == e = AppT (AppT (AppT MulArrowT m) eadtTy) (go b)- | otherwise = AppT (AppT (AppT MulArrowT m) a) (go b)+ -- Linear types don't support pattern synonyms (GHC#18806)+ -- Use normal arrows instead.+ , v == e = AppT (AppT ArrowT eadtTy) (go b)+ | otherwise = AppT (AppT ArrowT a) (go b) #endif go _ = eadtTy t' = go tys
src/lib/Haskus/Utils/Variant.hs view
@@ -1272,21 +1272,21 @@ instance ContVariant '[a] where {-# INLINABLE variantToCont #-}- variantToCont (Variant _ a) = ContFlow $ \(Solo f) ->+ variantToCont (Variant _ a) = ContFlow $ \(MkSolo f) -> f (unsafeCoerce a) {-# INLINABLE variantToContM #-}- variantToContM act = ContFlow $ \(Solo f) -> do+ variantToContM act = ContFlow $ \(MkSolo f) -> do Variant _ a <- act f (unsafeCoerce a) {-# INLINABLE contToVariant #-} contToVariant c = c >::>- Solo (toVariantAt @0)+ MkSolo (toVariantAt @0) {-# INLINABLE contToVariantM #-} contToVariantM c = c >::>- Solo (return . toVariantAt @0)+ MkSolo (return . toVariantAt @0) instance ContVariant '[a,b] where {-# INLINABLE variantToCont #-}
src/tests/EADT.hs view
@@ -27,8 +27,8 @@ -- List EADT ------------------------------- -data ConsF a l = ConsF a l deriving (Functor)-data NilF l = NilF deriving (Functor)+data ConsF a l = ConsF a l deriving (Eq,Ord,Show,Functor)+data NilF l = NilF deriving (Eq,Ord,Show,Functor) eadtPattern 'ConsF "Cons" eadtPattern 'NilF "Nil"