packages feed

haskus-utils-variant 2.0.1 → 2.0.2

raw patch · 3 files changed

+16/−3 lines, 3 files

Files

haskus-utils-variant.cabal view
@@ -1,6 +1,6 @@-cabal-version: >=1.20+cabal-version: 1.20 name: haskus-utils-variant-version: 2.0.1+version: 2.0.2 license: BSD3 license-file: LICENSE copyright: Sylvain Henry 2018
src/lib/Haskus/Utils/EADT.hs view
@@ -40,6 +40,7 @@    -- * Extensible ADT    , EADT    , (:<:)+   , (:<<:)    , pattern VF    , appendEADT    , liftEADT@@ -268,8 +269,14 @@ -- | An extensible ADT type EADT xs = Fix (VariantF xs) +-- | Constructor `f` is in `xs` type family f :<: xs where    f :<: xs = EADTF' f (EADT xs) xs++-- | Forall `x` in `xs`, `x :<: ys`+type family (:<<:) xs ys :: Constraint where+   '[] :<<: ys       = ()+   (x ': xs) :<<: ys = (x :<: ys, xs :<<: ys)  type EADTF' f e cs =    ( Member' f cs
src/lib/Haskus/Utils/Variant.hs view
@@ -24,6 +24,7 @@    , pattern V    , pattern VMaybe    , (:<)+   , (:<<)    , (:<?)    -- * Operations by index    , toVariantAt@@ -100,7 +101,7 @@ where  import Unsafe.Coerce-import GHC.Exts (Any)+import GHC.Exts (Any,Constraint) import Data.Typeable  import Haskus.Utils.Monad@@ -350,6 +351,11 @@    ( Member x xs    , x :<? xs    )++-- | Forall `x` in `xs`, `x :< ys`+type family (:<<) xs ys :: Constraint where+   '[] :<< ys       = ()+   (x ': xs) :<< ys = (x :< ys, xs :<< ys)  -- | A value of type "x" **might** be extracted from (V xs). -- We don't check that "x" is in "xs".