summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvainHenry <>2018-11-08 19:49:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-11-08 19:49:00 (GMT)
commit8a1f179c82de979e9dac6d6cf2b538387f885dc3 (patch)
tree4c625193419cc352dd678634019ba44d93f63a20
parent5bd595113c116ad6507f24b7122c9eca1d2cc55e (diff)
version 1.21.2
-rw-r--r--haskus-utils.cabal133
-rw-r--r--src/lib/Haskus/Utils/HArray.hs2
-rw-r--r--src/lib/Haskus/Utils/Parser.hs24
3 files changed, 83 insertions, 76 deletions
diff --git a/haskus-utils.cabal b/haskus-utils.cabal
index c2e7a72..0c5d68a 100644
--- a/haskus-utils.cabal
+++ b/haskus-utils.cabal
@@ -1,70 +1,77 @@
-cabal-version: >=1.21
-name: haskus-utils
-version: 1.1
-license: BSD3
-license-file: LICENSE
-copyright: Sylvain Henry 2018
-maintainer: sylvain@haskus.fr
-author: Sylvain Henry
-homepage: http://docs.haskus.org/
-synopsis: Haskus utility modules
+name: haskus-utils
+version: 1.2
+synopsis: Haskus utility modules
+license: BSD3
+license-file: LICENSE
+author: Sylvain Henry
+maintainer: sylvain@haskus.fr
+homepage: http://docs.haskus.org/
+copyright: Sylvain Henry 2018
+category: System
+build-type: Simple
+cabal-version: >=1.21
+
description:
- Haskus utility modules.
-category: System
-build-type: Simple
+ Haskus utility modules.
source-repository head
- type: git
- location: git://github.com/haskus/haskus-utils.git
+ type: git
+ location: git://github.com/haskus/haskus-utils.git
library
- exposed-modules:
- Haskus.Utils.Solver
- Haskus.Utils.Parser
- Haskus.Utils.HArray
- Haskus.Utils.MultiState
- Haskus.Utils.Embed
- Haskus.Utils.Flow
- Haskus.Utils.STM
- Haskus.Utils.STM.TEq
- Haskus.Utils.STM.TMap
- Haskus.Utils.STM.TSet
- Haskus.Utils.STM.TList
- Haskus.Utils.STM.TTree
- Haskus.Utils.STM.Future
- Haskus.Utils.STM.TGraph
- hs-source-dirs: src/lib
- default-language: Haskell2010
- ghc-options: -Wall
- build-depends:
- base >=4.9 && <4.12,
- haskus-utils-types ==1.1.*,
- haskus-utils-data ==1.1.*,
- haskus-utils-variant ==2.0.*,
- containers ==0.5.*,
- list-t >=0.4 && <1.1,
- stm ==2.4.*,
- stm-containers ==0.2.*,
- vector >=0.11 && <0.13,
- transformers >=0.4 && <0.6,
- mtl ==2.2.*,
- template-haskell >=2.10 && <2.14,
- file-embed >=0.0.10 && <0.1,
- extra >=1.4 && <1.7,
- recursion-schemes ==5.0.*
+ exposed-modules:
+ Haskus.Utils.Solver
+ Haskus.Utils.Parser
+ Haskus.Utils.HArray
+ Haskus.Utils.MultiState
+ Haskus.Utils.Embed
+ Haskus.Utils.Flow
+ Haskus.Utils.STM
+ Haskus.Utils.STM.TEq
+ Haskus.Utils.STM.TMap
+ Haskus.Utils.STM.TSet
+ Haskus.Utils.STM.TList
+ Haskus.Utils.STM.TTree
+ Haskus.Utils.STM.Future
+ Haskus.Utils.STM.TGraph
+
+ other-modules:
+
+ build-depends:
+ base >= 4.9 && < 5
+ , haskus-utils-types >= 1.3
+ , haskus-utils-data
+ , haskus-utils-variant >= 2.3
+ , containers >= 0.5
+ , list-t >= 0.4
+ , stm >= 2.4
+ , stm-containers >= 0.2
+ , vector >= 0.11
+ , transformers >= 0.4
+ , mtl >= 2.2
+ , template-haskell >= 2.10
+ , file-embed >= 0.0.10
+ , extra >= 1.4
+ , recursion-schemes >= 5.0
+
+ build-tools:
+ ghc-options: -Wall
+ default-language: Haskell2010
+ hs-source-dirs: src/lib
test-suite tests
- type: exitcode-stdio-1.0
- main-is: Main.hs
- hs-source-dirs: src/tests
- other-modules:
- Haskus.Tests.Utils
- Haskus.Tests.Utils.HArray
- Haskus.Tests.Utils.Solver
- default-language: Haskell2010
- ghc-options: -Wall -threaded
- build-depends:
- base >=4.11.1.0 && <4.12,
- haskus-utils -any,
- tasty >=0.11 && <1.2,
- tasty-quickcheck >=0.8 && <0.11
+ type: exitcode-stdio-1.0
+ main-is: Main.hs
+ hs-source-dirs: src/tests
+ ghc-options: -Wall -threaded
+ default-language: Haskell2010
+ other-modules:
+ Haskus.Tests.Utils
+ , Haskus.Tests.Utils.HArray
+ , Haskus.Tests.Utils.Solver
+
+ build-depends:
+ base
+ , haskus-utils
+ , tasty >= 0.11
+ , tasty-quickcheck >= 0.8
diff --git a/src/lib/Haskus/Utils/HArray.hs b/src/lib/Haskus/Utils/HArray.hs
index 1c3abcc..8530021 100644
--- a/src/lib/Haskus/Utils/HArray.hs
+++ b/src/lib/Haskus/Utils/HArray.hs
@@ -63,7 +63,7 @@ type HArrayIndex (n :: Nat) t (ts :: [*]) =
-- | A type `t` is indexable in the array
type HArrayIndexT t (ts :: [*]) =
- ( IsMember t ts ~ 'True
+ ( CheckMember t ts
, HArrayIndex (IndexOf t ts) t ts
)
diff --git a/src/lib/Haskus/Utils/Parser.hs b/src/lib/Haskus/Utils/Parser.hs
index cfa35b5..8ab70f9 100644
--- a/src/lib/Haskus/Utils/Parser.hs
+++ b/src/lib/Haskus/Utils/Parser.hs
@@ -56,9 +56,9 @@ instance forall x y z xs ys zs m a.
, y ~ Flow m ys
, z ~ Flow m zs
, a :< xs
- , Liftable ys zs
- , Liftable (Filter a xs) zs
- , zs ~ Union (Filter a xs) ys
+ , LiftVariant ys zs
+ , LiftVariant (Remove a xs) zs
+ , zs ~ Union (Remove a xs) ys
, Monad m
) => Apply (Choice a) (x,y) z
where
@@ -85,7 +85,7 @@ choice' = hFoldl (Choice :: Choice a) (flowSingle undefined :: Flow m '[a])
-- | Apply the action zero or more times (until a ParseError result is
-- returned)
many ::
- ( zs ~ Filter ParseError xs
+ ( zs ~ Remove ParseError xs
, Monad m
, ParseError :< xs
) => Flow m xs -> Flow m '[[V zs]]
@@ -95,7 +95,7 @@ many f = manyBounded Nothing Nothing f
-- | Apply the action zero or more times (up to max) until a ParseError result
-- is returned
manyAtMost ::
- ( zs ~ Filter ParseError xs
+ ( zs ~ Remove ParseError xs
, Monad m
, ParseError :< xs
) => Word -> Flow m xs -> Flow m '[[V zs]]
@@ -105,7 +105,7 @@ manyAtMost max f = manyBounded Nothing (Just max) f
-- | Apply the action zero or more times (up to max) until a ParseError result
-- is returned
manyAtMost' ::
- ( zs ~ Filter ParseError xs
+ ( zs ~ Remove ParseError xs
, Monad m
, ParseError :< xs
) => Word -> Flow m xs -> m [V zs]
@@ -114,7 +114,7 @@ manyAtMost' max f = variantToValue <$> manyAtMost max f
-- | Apply the action zero or more times (up to max) until a ParseError result
-- is returned
manyAtMost'' ::
- ( '[x] ~ Filter ParseError xs
+ ( '[x] ~ Remove ParseError xs
, Monad m
, ParseError :< xs
) => Word -> Flow m xs -> m [x]
@@ -123,7 +123,7 @@ manyAtMost'' max f = fmap variantToValue <$> manyAtMost' max f
-- | Apply the action at least n times or more times (until a ParseError
-- result is returned)
manyAtLeast ::
- ( zs ~ Filter ParseError xs
+ ( zs ~ Remove ParseError xs
, Monad m
, ParseError :< xs
) => Word -> Flow m xs -> Flow m '[[V zs],ParseError]
@@ -134,8 +134,8 @@ manyAtLeast min = manyBounded (Just min) Nothing
--
-- Return both the list of first values and the ending value
manyTill ::
- ( zs ~ Filter ParseError xs
- , zs' ~ Filter ParseError ys
+ ( zs ~ Remove ParseError xs
+ , zs' ~ Remove ParseError ys
, Monad m
, ParseError :<? xs
, ParseError :< ys
@@ -158,7 +158,7 @@ manyTill f g = go []
--
-- Return only the list of first values
manyTill' ::
- ( zs ~ Filter ParseError xs
+ ( zs ~ Remove ParseError xs
, Monad m
, ParseError :<? xs
, ParseError :< ys
@@ -169,7 +169,7 @@ manyTill' f g = manyTill f g >.-.> fst
--
-- On failure, fails.
manyBounded :: forall zs xs m.
- ( zs ~ Filter ParseError xs
+ ( zs ~ Remove ParseError xs
, Monad m
, ParseError :<? xs
) => Maybe Word -> Maybe Word -> Flow m xs -> Flow m '[[V zs],ParseError]