haskus / packages Goto Github PK
View Code? Open in Web Editor NEWHaskus packages
Home Page: https://docs.haskus.org/
Haskus packages
Home Page: https://docs.haskus.org/
Hello again!
I've been trying to build haskus-system
and its dependencies on ghc 9.8.1 and I believe I've already managed to patch most of the ghc API incompatibilities in the haskus-binary
package here:
pillowtrucker@176709d
but there's still one error thrown by cabal that I just don't understand:
src/lib/Haskus/Memory/Buffer.hs:167:18: error: [GHC-18872]
• Couldn't match a lifted type with an unlifted type
When matching types
a0 :: *
(# (# #) | MutVar# RealWorld [IO ()] #) :: TYPE
(SumRep [ZeroBitRep, UnliftedRep])
Expected: a0
Actual: Finalizers# RealWorld
• In the first argument of ‘mkWeak#’, namely ‘fin’
In the expression: mkWeak# fin b (unIO $ runFinalizers fin) s
In the expression:
case mkWeak# fin b (unIO $ runFinalizers fin) s of
(# s1, _wk #) -> (# s1, () #)
|
167 | case mkWeak# fin b (unIO $ runFinalizers fin) s of
I've tried to work around it by using compatMkWeak#
from the basement
package, but that seems to be an even earlier implementation of mkWeak#
and it doesn't help.
I'm afraid I don't really understand what has changed there any how/why
When I create the following node definition:
data AddF e = AddF e (e, e) deriving (Functor)
eadtPattern 'AddF "Add"
I get the following error message:
The exact Name `e_ac8q' is not in scope
Probable cause: you used a unique Template Haskell name (NameU),
perhaps via newName, but did not bind it
If that's it, then -ddump-splices might be useful
|
14 | eadtPattern 'AddF "Add"
| ^^^^^^^^^^^^^^^^^^^^^^^
I suspect it is because of the tuple (e,e).
Failed to build haskus-utils-variant-3.3.
Build log (
/home/hasufell/.cabal/logs/ghc-9.6.4/haskus-utils-variant-3.3-80dfcc24a7654b551bb44bfbea753796ab68774d499f49d39a1fe3fa11874c89.log
):
Configuring library for haskus-utils-variant-3.3..
Preprocessing library for haskus-utils-variant-3.3..
Building library for haskus-utils-variant-3.3..
[1 of 9] Compiling Haskus.Utils.ContFlow ( src/lib/Haskus/Utils/ContFlow.hs, dist/build/Haskus/Utils/ContFlow.o, dist/build/Haskus/Utils/ContFlow.dyn_o )
src/lib/Haskus/Utils/ContFlow.hs:88:29: warning: [GHC-68441] [-Wdeprecations]
In the use of data constructor ‘Solo’
(imported from Haskus.Utils.Tuple, but defined in GHC.Tuple):
Deprecated: "The Solo constructor has been renamed to MkSolo to avoid punning."
|
88 | (>:-:>) (ContFlow f) c = f (Solo c)
| ^^^^
[2 of 9] Compiling Haskus.Utils.Variant ( src/lib/Haskus/Utils/Variant.hs, dist/build/Haskus/Utils/Variant.o, dist/build/Haskus/Utils/Variant.dyn_o )
src/lib/Haskus/Utils/Variant.hs:1266:47: warning: [GHC-68441] [-Wdeprecations]
In the use of data constructor ‘Solo’
(imported from Haskus.Utils.Tuple, but defined in GHC.Tuple):
Deprecated: "The Solo constructor has been renamed to MkSolo to avoid punning."
|
1266 | variantToCont (Variant _ a) = ContFlow $ \(Solo f) ->
| ^^^^
src/lib/Haskus/Utils/Variant.hs:1270:38: warning: [GHC-68441] [-Wdeprecations]
In the use of data constructor ‘Solo’
(imported from Haskus.Utils.Tuple, but defined in GHC.Tuple):
Deprecated: "The Solo constructor has been renamed to MkSolo to avoid punning."
|
1270 | variantToContM act = ContFlow $ \(Solo f) -> do
| ^^^^
src/lib/Haskus/Utils/Variant.hs:1276:7: warning: [GHC-68441] [-Wdeprecations]
In the use of data constructor ‘Solo’
(imported from Haskus.Utils.Tuple, but defined in GHC.Tuple):
Deprecated: "The Solo constructor has been renamed to MkSolo to avoid punning."
|
1276 | Solo (toVariantAt @0)
| ^^^^
src/lib/Haskus/Utils/Variant.hs:1280:7: warning: [GHC-68441] [-Wdeprecations]
In the use of data constructor ‘Solo’
(imported from Haskus.Utils.Tuple, but defined in GHC.Tuple):
Deprecated: "The Solo constructor has been renamed to MkSolo to avoid punning."
|
1280 | Solo (return . toVariantAt @0)
| ^^^^
[3 of 9] Compiling Haskus.Utils.Variant.Syntax ( src/lib/Haskus/Utils/Variant/Syntax.hs, dist/build/Haskus/Utils/Variant/Syntax.o, dist/build/Haskus/Utils/Variant/Syntax.dyn_o )
[4 of 9] Compiling Haskus.Utils.Variant.VEither ( src/lib/Haskus/Utils/Variant/VEither.hs, dist/build/Haskus/Utils/Variant/VEither.o, dist/build/Haskus/Utils/Variant/VEither.dyn_o )
[5 of 9] Compiling Haskus.Utils.Variant.Excepts ( src/lib/Haskus/Utils/Variant/Excepts.hs, dist/build/Haskus/Utils/Variant/Excepts.o, dist/build/Haskus/Utils/Variant/Excepts.dyn_o )
[6 of 9] Compiling Haskus.Utils.VariantF ( src/lib/Haskus/Utils/VariantF.hs, dist/build/Haskus/Utils/VariantF.o, dist/build/Haskus/Utils/VariantF.dyn_o )
src/lib/Haskus/Utils/VariantF.hs:166:4: error: [GHC-05617]
• Could not deduce ‘ConstraintAll1 Eq1 fs’
arising from the head of a quantified constraint
arising from the superclasses of an instance declaration
from the context: (Eq1 f, Eq1 (VariantF fs))
bound by the instance declaration
at src/lib/Haskus/Utils/VariantF.hs:(166,4)-(168,29)
or from: Eq a
bound by a quantified context
at src/lib/Haskus/Utils/VariantF.hs:(166,4)-(168,29)
• In the instance declaration for ‘Eq1 (VariantF (f : fs))’
|
166 | ( Eq1 f
| ^^^^^^^...
src/lib/Haskus/Utils/VariantF.hs:178:4: error: [GHC-05617]
• Could not deduce: (ConstraintAll1 Ord1 fs, ConstraintAll1 Eq1 fs)
arising from the head of a quantified constraint
arising from the superclasses of an instance declaration
from the context: (Ord1 f, Ord1 (VariantF fs))
bound by the instance declaration
at src/lib/Haskus/Utils/VariantF.hs:(178,4)-(180,30)
or from: Ord a
bound by a quantified context
at src/lib/Haskus/Utils/VariantF.hs:(178,4)-(180,30)
• In the instance declaration for ‘Ord1 (VariantF (f : fs))’
|
178 | ( Ord1 f
| ^^^^^^^^...
src/lib/Haskus/Utils/VariantF.hs:192:4: error: [GHC-05617]
• Could not deduce ‘ConstraintAll1 Show1 fs’
arising from the head of a quantified constraint
arising from the superclasses of an instance declaration
from the context: (Show1 f, Show1 (VariantF fs))
bound by the instance declaration
at src/lib/Haskus/Utils/VariantF.hs:(192,4)-(194,31)
or from: Show a
bound by a quantified context
at src/lib/Haskus/Utils/VariantF.hs:(192,4)-(194,31)
• In the instance declaration for ‘Show1 (VariantF (f : fs))’
|
192 | ( Show1 f
| ^^^^^^^^^...
Error: cabal: Failed to build haskus-utils-variant-3.3 (which is required by
exe:ghcup from ghcup-0.1.20.0). See the build log above for details.
2.6.1 still uses FlowT
: https://hackage.haskell.org/package/haskus-utils-variant-2.6.1
Minimal repro here: https://github.com/hasufell/excepts-bug
More specifically, the following code:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}
module Main where
import Control.Monad
import Control.Monad.IO.Class
import Haskus.Utils.Variant.Excepts
data MyError = MyError String
main :: IO ()
main = do
e1 <- runE ex1
putStrLn $ show e1
e2 <- runE ex2
putStrLn $ show e2
where
ex1 :: MonadIO m => Excepts '[MyError] m ()
ex1 = void $ forM [1, 2] $ \i -> do
liftIO $ putStrLn $ show i
throwE (MyError $ show i)
ex2 :: MonadIO m => Excepts '[MyError] m ()
ex2 = forM_ [1, 2] $ \i -> do
liftIO $ putStrLn $ show i
throwE (MyError $ show i)
will print
1
2
VLeft MyError "1"
1
VLeft MyError "1"
This was discovered in ghcup, where an error doesn't short-circuit the computation.
haskus-utils > /tmp/stack-329766d28a844ae1/haskus-utils-1.4/src/lib/Haskus/Utils/Flow.hs:45:1: error:
haskus-utils > Could not find module ‘Haskus.Utils.Variant.Flow’
happstack-server[-tls]
isn't always updated on stackage and has a lot of dependencies. We should replace them with wai
and warp[-tls]
.
I am trying to use haskus-binary
in my stack project. To do so, I have added:
dependencies:
- base >= 4.9 && < 5
- haskus-binary == 1.4
To package.yaml
.
When I execute stack build
, I encounter errors which end up recommending I add extra-deps
to stack.yaml
. After doing this a few times, stack.yaml
contains:
extra-deps:
- haskus-binary-1.4@sha256:b0fc1d78e01abf2ba47a92f042c48ced0c6dfc9520712d573b094743b3ee2dac,3897
- haskus-utils-1.4@sha256:48dd6e48f5e881fd1625f25ffcd9f223a164b002efdd98466be21fbc0d3240cc,2154
- haskus-utils-data-1.2@sha256:6dd3ecb6671b3eb888e479b5beb4a9fa7cee09c91683c88c501db6cd0177e427,1508
- haskus-utils-types-1.5@sha256:8f5ddbe1cd1c654e5cfaa6da1f12bd8d71e2d41216475d1a0dfd5590e5e68b1c,1294
- primitive-0.6.4.0@sha256:5b6a2c3cc70a35aabd4565fcb9bb1dd78fe2814a36e62428a9a1aae8c32441a1,2079
However, this ultimately fails with:
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for haskus-utils-1.4:
haskus-utils-variant must match >=2.4, but the stack configuration has no specified version (latest matching version is 3.0)
needed due to MIL-STD-1553C-Simulator-0.1.0.0 -> haskus-utils-1.4
In the dependencies for primitive-0.6.4.0:
base-4.13.0.0 from stack configuration does not match >=4.5 && <4.13 (latest matching version is 4.12.0.0)
needed due to MIL-STD-1553C-Simulator-0.1.0.0 -> primitive-0.6.4.0
Some different approaches to resolving this:
* Build requires unattainable version of base. Since base is a part of GHC, you most likely need to use a different GHC version with the matching base.
I am not entirely sure if this is a misconfiguration on my end or a problem with the haskus dependencies.
What should I do so that I may use haskus-binary
in my project?
I appreciate the help!
Hello, thanks for the very neat library!
x :: V '[Int,String]
x = V @int 1
y :: ('[String,Int] :<< v) => V v
y = liftVariant x
gives a type error
Could not deduce: Haskus.Utils.Types.List.IsSubset '[Int,String] v ~ 'True
arising from a use of liftVariant
from the context: '[String, Int] :<< v
bound by the type signature for:
y :: forall (v :: [*]). ('[String, Int] :<< v) => V v
Should IsSubset be True here (as subset relation should be reflexive)?
Cheers!
I'm going to use EADTs in a transpiler in front of a constraint solver. I love the idea of starting with a small constraint language, and adding new features to the language progressively: with EADT, it will be easy to add typecheck, annotate, transform and reduce steps for each new feature.
What is not clear to me is how to design an extensible Parser (e.g. using megaparsec), i.e. how to extend the parser with each new language construct. Could you elaborate on that, and update the documentation if appropriate ?
Thanks in advance.
Is there any reason why there is no Eq instance for Haskus.Utils.Variant.VEither
?
I'm currently using this Orphan:
instance ( Eq a, Eq (V es)) => Eq (VEither es a) where
(==) (VLeft as) (VLeft bs) = as == bs
(==) (VRight a) (VRight b) = a == b
(==) _ _ = False
If there are no arguments against it, i can create a PR for this.
In popVariantF, the selected constructor is on Right, while in splitVariantF, they are in Left...
It would be more consistent to have them on the same side (but that would be a breaking change)...
Are these usually defined in the upstream package?
Since release 2.0.2, the haddock-generated documentation of each module of haskus-utils-variant is not available on hackage anymore: e.g. EADT.
Same for haskus-utils-types-1.2
I discovered Variant from http://hsyl20.fr/home/posts/2018-05-22-extensible-adt.html and am going to be experimenting with it. However, it would be nice to be able to use it without getting all of the other things in haskus-utils.
I'm trying to write a pattern for an EADT type that contains a less general, parameterised EADT type, but I receive the following ambiguous type variable error. I've reproduced the error in a minimum working example, below. In the example, the definition of bar causes the error.
Adding a type annotation (seen on baz
) fixes the error. However, it seems obvious to me that the second argument to C'
should be a T1 Bool
. Thus I'm wondering if it's somehow possible to get the compiler to figure this out itself.
VarBug.hs:23:7: error:
• Couldn't match type ‘Haskus.Utils.Types.List.Filter
(C'F a0 (EADT '[CF Bool, C'F Bool]))
(Haskus.Utils.Types.List.RemoveAt1
(Haskus.Utils.Types.List.MaybeIndexOf'
1
(C'F a0 (EADT '[CF Bool, C'F Bool]))
'[C'F Bool (Fix (VariantF '[CF Bool, C'F Bool]))])
'[CF Bool (Fix (VariantF '[CF Bool, C'F Bool])),
C'F Bool (Fix (VariantF '[CF Bool, C'F Bool]))])’
with ‘CF Bool (Fix (VariantF '[CF Bool, C'F Bool]))
: Haskus.Utils.Types.List.Filter
(C'F a0 (EADT '[CF Bool, C'F Bool]))
'[C'F Bool (Fix (VariantF '[CF Bool, C'F Bool]))]’
arising from a use of ‘C'’
The type variable ‘a0’ is ambiguous
• In the expression: C' (C True) (C True)
In an equation for ‘bar’: bar = C' (C True) (C True)
|
23 | bar = C' (C True) (C True)
| ^^^^^^^^^^^^^^^^^^^^
VarBug.hs:23:20: error:
• Couldn't match type ‘Haskus.Utils.Types.List.Filter
(CF Bool (EADT '[CF a0]))
(Haskus.Utils.Types.List.RemoveAt1
(Haskus.Utils.Types.List.MaybeIndexOf'
0 (CF Bool (EADT '[CF a0])) '[CF a0 (Fix (VariantF '[CF a0])
)])
'[CF a0 (Fix (VariantF '[CF a0]))])’
with ‘Haskus.Utils.Types.List.Filter
(CF Bool (EADT '[CF a0])) '[CF a0 (Fix (VariantF '[CF a0]))]’
arising from a use of ‘C’
NB: ‘Haskus.Utils.Types.List.Filter’ is a type function, and may not be injective
The type variable ‘a0’ is ambiguous
• In the second argument of ‘C'’, namely ‘(C True)’
In the expression: C' (C True) (C True)
In an equation for ‘bar’: bar = C' (C True) (C True)
|
23 | bar = C' (C True) (C True)
| ^^^^^^
Failed, no modules loaded.
This code produces the error above, but the annotation on baz makes it work:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TypeOperators #-}
import Haskus.Utils.VariantF
import Prelude
data CF a f = CF a deriving (Functor)
type T1 a = EADT '[CF a]
data C'F a f = C'F f (T1 a) deriving (Functor)
type T2 a = EADT '[CF a, C'F a]
pattern C :: (CF a :<: xs) => a -> EADT xs
pattern C x = VF (CF x)
pattern C' :: (C'F a :<: xs) => EADT xs -> T1 a -> EADT xs
pattern C' x y = VF (C'F x y)
bar :: T2 Bool
bar = C' (C True) (C True)
--baz :: T2 Bool
--baz = C' (C True) (C True :: T1 Bool)
I'm envisioning an exception system where I rethrow low-level exceptions as high-level exceptions, while still encapsulating the underlying error. An example:
------------------------
--[ Low-level errors ]--
------------------------
data HTTPStatusError = HTTPStatusError Int
deriving Show
data NoLocationHeader = NoLocationHeader
deriving Show
data TooManyRedirs = TooManyRedirs
deriving Show
-------------------------
--[ High-level errors ]--
-------------------------
-- | A download failed. The underlying error is encapsulated.
data DownloadFailed = forall es . Show (V es) => DownloadFailed (V es)
deriving instance Show DownloadFailed
-------------------------------
--[ Error handling funtions ]--
-------------------------------
-- https://hackage.haskell.org/package/haskus-utils-variant-3.0/docs/Haskus-Utils-Variant-Excepts.html
reThrowAll :: forall e es es' a m
. (Monad m, e :< es')
=> (V es -> e)
-> Excepts es m a
-> Excepts es' m a
reThrowAll f = catchAllE (throwE . f)
reThrowAllIO :: forall e es es' a m
. ( MonadCatch m
, Monad m
, MonadIO m
, e :< es'
, es ~ '[IOException]
)
=> (V es -> e)
-> Excepts es m a
-> Excepts es' m a
reThrowAllIO f =
handleIO (throwE . f . variantFromValue) . catchAllE (throwE . f)
There are currently two problems with this approach:
data Foo = Foo
deriving Show
data Bar = Bar
deriving Show
foo :: Monad m => Excepts '[Bar , Foo] m ()
foo = do
throwE Bar
pure ()
This makes it impossible to know which errors are "lies" after a refactor.
Any ideas?
Hello @hsyl20
What do u think about create HVariantF
for GADTs?
And use indexed version of Fix
with polykinds?
On GHC-8.2.2 and older:
Configuring library for haskus-utils-types-1.5..
Preprocessing library for haskus-utils-types-1.5..
Building library for haskus-utils-types-1.5..
[1 of 9] Compiling Haskus.Utils.Types.Bool ( src/lib/Haskus/Utils/Types/Bool.hs, /tmp/matrix-worker/1576926666/dist-newstyle/build/x86_64-linux/ghc-8.2.2/haskus-utils-types-1.5/build/Haskus/Utils/Types/Bool.o )
[2 of 9] Compiling Haskus.Utils.Types.Constraint ( src/lib/Haskus/Utils/Types/Constraint.hs, /tmp/matrix-worker/1576926666/dist-newstyle/build/x86_64-linux/ghc-8.2.2/haskus-utils-types-1.5/build/Haskus/Utils/Types/Constraint.o )
[3 of 9] Compiling Haskus.Utils.Types.Error ( src/lib/Haskus/Utils/Types/Error.hs, /tmp/matrix-worker/1576926666/dist-newstyle/build/x86_64-linux/ghc-8.2.2/haskus-utils-types-1.5/build/Haskus/Utils/Types/Error.o )
[4 of 9] Compiling Haskus.Utils.Types.Nat ( src/lib/Haskus/Utils/Types/Nat.hs, /tmp/matrix-worker/1576926666/dist-newstyle/build/x86_64-linux/ghc-8.2.2/haskus-utils-types-1.5/build/Haskus/Utils/Types/Nat.o )
src/lib/Haskus/Utils/Types/Nat.hs:111:40: error:
Not in scope: type constructor or class ‘Log2’
|
111 | NatBitCount n = NatBitCount' (n+1) (Log2 (n+1))
|
and GHC-8.10.1 (which is soon to be released):
src/lib/Haskus/Utils/Types/List.hs:312:1: error:
• Illegal result type variable (r :: k) for ‘Index'’
Enable TypeFamilyDependencies to allow result variable names
• In the type family declaration for ‘Index'’
|
312 | type family Index' (n :: Nat) (l :: [k]) (l2 :: [k]) = (r :: k) where
| ^^
Packages that are uploaded to Hackage are generally expected to follow
the Package Versioning Policy and have version bounds on all
dependencies indicating which versions they are known to build with.
Here are some links that have more information:
https://hackage.haskell.org/upload#versioning_and_curation
https://pvp.haskell.org/
Add support for:
eadtInfixPattern 'AbsF ":->"
====>
pattern a :-> b = VF (AbsF a b)
Currently this package prevent people from running ghcup on nixos.
I think the error message expected in DocTests changed.
I am trying to prepare a PR.
I am modeling a mutually recursive data structure (AST) and unable to make sense of the type check errors from GHC. Here is the essence of the problem.
data AF b f = AF b deriving (Functor)
eadtPattern 'AF "A"
data BF a f = BF a deriving (Functor)
eadtPattern 'BF "B"
foo :: EADT '[AF b, BF a] -> EADT '[AF b, BF a]
foo b = A b
The error is:
src/Types2.hs:390:9: error:
• Couldn't match type ‘Haskus.Utils.Types.List.Index'
(Haskus.Utils.Types.List.IndexOf'
(Haskus.Utils.Types.List.MaybeIndexOf'
0
(AF (EADT '[AF b, BF a]) (EADT '[AF b, BF a]))
'[AF b (EADT '[AF b, BF a]), BF a (EADT '[AF b, BF a])])
(AF (EADT '[AF b, BF a]) (EADT '[AF b, BF a]))
'[AF b (EADT '[AF b, BF a]), BF a (EADT '[AF b, BF a])])
'[AF b (EADT '[AF b, BF a]), BF a (EADT '[AF b, BF a])]
'[AF b (EADT '[AF b, BF a]), BF a (EADT '[AF b, BF a])]’
with ‘AF (EADT '[AF b, BF a]) (EADT '[AF b, BF a])’
arising from a use of ‘A’
• In the expression: A b
In an equation for ‘bar’: bar b = A b
• Relevant bindings include
b :: EADT '[AF b, BF a] (bound at src/Types2.hs:390:5)
bar :: EADT '[AF b, BF a] -> EADT '[AF b, BF a]
(bound at src/Types2.hs:390:1)
|
390 | bar b = A b
| ^^^
I was expecting the type of A b
to EADT '[AF b, BF a]
but clearly it's not. My questions is, how do I decode this error?
I'm tring to compare 2 EADT values, but I get:
No instance for (Data.Functor.Classes.Eq1 (VariantF '[ValF, EmptyNoteF]))
arising from a use of ‘==’
Hi,
I'm curious whether Excepts has a valid MonadUnliftIO instance http://hackage.haskell.org/package/unliftio-core-0.1.2.0/docs/Control-Monad-IO-Unlift.html.
I'm not sure about whether Excepts type provides a solution to what's called "state discarding problem" in control functions, which is described here https://www.youtube.com/watch?v=KZIN9f9rI34&feature=youtu.be&t=794. It seems the problem for ExceptT is that two Left values can't unify, whereas Excepts type can.
Thanks!
Hi,
I am trying out the Variant code and I am curious if there is a way to check the size of the Variant types, not the size of the value.
for v :: V '[A, B, C, D] I would like to to get the size of 4 out. Thank you for your help.
It would be nice to be able to write:
( '[Nilf, ConsF] :<<: xs) =>
instead of
(NilF :<: xs, ConsF :<: xs) => ...
Hi,
FlowT in 2.4 is a very ergonomic alternative compare to Variant on the Left of Either. I like it a lot. Just want to bring up an enhancement for discussion.
Since it has a MonadIO instance, should FlowT also provide MonadMask instance (and its superclass instances)?
http://hackage.haskell.org/package/exceptions-0.10.0/docs/Control-Monad-Catch.html#v:generalBracket
btw, I'm not proposing that FlowT needs all n^2 mtl instances because Variant on the Left of ExceptT already serves that purpose well enough for now.
Thanks!
Feng
haskus-utils-variant 2.1.1 requires:
And haskus-utils-data 1.1 requires haskus-utils-types 1.1... We can't have both haskus-utils-types 1.1 and 1.2.
can't access https://docs.haskus.org/ or any related content
haskus-utils-variant Fails to build with GHC 9.2.1
it errors as logged here:-
Configuring library for haskus-utils-variant-3.1..
Preprocessing library for haskus-utils-variant-3.1..
Building library for haskus-utils-variant-3.1..
[1 of 9] Compiling Haskus.Utils.ContFlow ( src/lib/Haskus/Utils/ContFlow.hs, dist/build/Haskus/Utils/ContFlow.o, dist/build/Haskus/Utils/ContFlow.dyn_o )
[2 of 9] Compiling Haskus.Utils.Variant ( src/lib/Haskus/Utils/Variant.hs, dist/build/Haskus/Utils/Variant.o, dist/build/Haskus/Utils/Variant.dyn_o )
[3 of 9] Compiling Haskus.Utils.Variant.Syntax ( src/lib/Haskus/Utils/Variant/Syntax.hs, dist/build/Haskus/Utils/Variant/Syntax.o, dist/build/Haskus/Utils/Variant/Syntax.dyn_o )
[4 of 9] Compiling Haskus.Utils.Variant.VEither ( src/lib/Haskus/Utils/Variant/VEither.hs, dist/build/Haskus/Utils/Variant/VEither.o, dist/build/Haskus/Utils/Variant/VEither.dyn_o )
[5 of 9] Compiling Haskus.Utils.Variant.Excepts ( src/lib/Haskus/Utils/Variant/Excepts.hs, dist/build/Haskus/Utils/Variant/Excepts.o, dist/build/Haskus/Utils/Variant/Excepts.dyn_o )
[6 of 9] Compiling Haskus.Utils.VariantF ( src/lib/Haskus/Utils/VariantF.hs, dist/build/Haskus/Utils/VariantF.o, dist/build/Haskus/Utils/VariantF.dyn_o )
[7 of 9] Compiling Haskus.Utils.EGADT ( src/lib/Haskus/Utils/EGADT.hs, dist/build/Haskus/Utils/EGADT.o, dist/build/Haskus/Utils/EGADT.dyn_o )
[8 of 9] Compiling Haskus.Utils.EADT ( src/lib/Haskus/Utils/EADT.hs, dist/build/Haskus/Utils/EADT.o, dist/build/Haskus/Utils/EADT.dyn_o )
[9 of 9] Compiling Haskus.Utils.EADT.TH ( src/lib/Haskus/Utils/EADT/TH.hs, dist/build/Haskus/Utils/EADT/TH.o, dist/build/Haskus/Utils/EADT/TH.dyn_o )
src/lib/Haskus/Utils/EADT/TH.hs:134:27: error:
• Couldn't match expected type ‘Pat’
with actual type ‘[Pat] -> Pat’
• Probable cause: ‘ConP’ is applied to too few arguments
In the fourth argument of ‘PatSynD’, namely
‘(ConP vf [ConP consName (fmap VarP conArgs)])’
In the expression:
PatSynD
patName args ImplBidir
(ConP vf [ConP consName (fmap VarP conArgs)])
In an equation for ‘pat’:
pat
= PatSynD
patName args ImplBidir
(ConP vf [ConP consName (fmap VarP conArgs)])
|
134 | (ConP vf [ConP consName (fmap VarP conArgs)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/lib/Haskus/Utils/EADT/TH.hs:134:36: error:
• Couldn't match expected type ‘Type’
with actual type ‘[Pat] -> Pat’
• Probable cause: ‘ConP’ is applied to too few arguments
In the expression: ConP consName (fmap VarP conArgs)
In the second argument of ‘ConP’, namely
‘[ConP consName (fmap VarP conArgs)]’
In the fourth argument of ‘PatSynD’, namely
‘(ConP vf [ConP consName (fmap VarP conArgs)])’
|
134 | (ConP vf [ConP consName (fmap VarP conArgs)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/lib/Haskus/Utils/EADT/TH.hs:134:56: error:
• Couldn't match type ‘Pat’ with ‘Type’
Expected: Name -> Type
Actual: Name -> Pat
• In the first argument of ‘fmap’, namely ‘VarP’
In the second argument of ‘ConP’, namely ‘(fmap VarP conArgs)’
In the expression: ConP consName (fmap VarP conArgs)
|
134 | (ConP vf [ConP consName (fmap VarP conArgs)])
| ^^^^
cabal: Failed to build haskus-utils-variant-3.1 (which is required by
exe:ghcup from ghcup-0.1.17.3 and test:ghcup-test from ghcup-0.1.17.3). See
the build log above for details.
I'm trying to simplify generic constructor removal like this:
alg2 x = case splitVariantF @'[EvenF Int, OddF Int] x of
Left v -> variantFToCont v >::>
( \(EvenF a l) -> Cons a l
, \(OddF a l) -> Cons a l
)
Right leftovers -> ...
Unfortunately, I can't find a way to leave leftovers unchanged: is there a way out ?
GHC now supports asm files with addForeignFilePath (see https://gitlab.haskell.org/ghc/ghc/issues/16180). Use this instead of asm inlined into a c file.
I'm unsure whether this is impossible or just requires modifications on the library side, but deriving standalone instances of Data and Generic doesn't work.
:145:1: error:
• Can't make a derived instance of ‘Generic (Variant xs)’:
The data constructors of ‘Variant’ are not all in scope
so you cannot derive an instance for it
• In the stand-alone deriving instance for ‘Generic (Variant xs)’
|
145 | deriving instance Generic (Variant xs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:148:1: error:
• Can't make a derived instance of ‘Data (Variant xs)’:
The data constructors of ‘Variant’ are not all in scope
so you cannot derive an instance for it
• In the stand-alone deriving instance for
‘(Typeable xs) => Data (Variant xs)’
|
148 | deriving instance (Typeable xs) => Data (Variant xs)
Hi,
I hope you do not mind my follow up question. I am trying to get a hang on working with Type in Haskell and Variant in particular. Could we just check without order if V as and V bs are equal at type level? And to have an equality check just on V type and not value, we would need to define Type family to inductively check on type in V? I did play around with the example and it looks like == would check based on values. I appreciate your help.
Reload time of my program in ghci takes more than 20 seconds when my EADT has more than 10 constsructors. As I add more constructors, it gets exponentially worse.
Specifically, Data.Primitive.ByteArray.Addr
doesn't exist in primitive-0.7.0.0
:
[15 of 43] Compiling Haskus.Memory.Buffer ( src/lib/Haskus/Memory/Buffer.hs, dist/build/Haskus/Memory/Buffer.o )
src/lib/Haskus/Memory/Buffer.hs:414:10: error:
Not in scope: data constructor ‘BA.Addr’
Neither ‘Data.Primitive.ByteArray’ nor ‘Data.Primitive.Types’ exports ‘Addr’.
|
414 | let !(BA.Addr addr) = BA.byteArrayContents ba
| ^^^^^^^
src/lib/Haskus/Memory/Buffer.hs:419:10: error:
Not in scope: data constructor ‘BA.Addr’
Neither ‘Data.Primitive.ByteArray’ nor ‘Data.Primitive.Types’ exports ‘Addr’.
|
419 | let !(BA.Addr addr) = BA.mutableByteArrayContents ba
| ^^^^^^^
src/lib/Haskus/Memory/Buffer.hs:424:10: error:
Not in scope: data constructor ‘BA.Addr’
Neither ‘Data.Primitive.ByteArray’ nor ‘Data.Primitive.Types’ exports ‘Addr’.
|
424 | let !(BA.Addr addr) = BA.byteArrayContents ba
| ^^^^^^^
src/lib/Haskus/Memory/Buffer.hs:429:10: error:
Not in scope: data constructor ‘BA.Addr’
Neither ‘Data.Primitive.ByteArray’ nor ‘Data.Primitive.Types’ exports ‘Addr’.
|
429 | let !(BA.Addr addr) = BA.mutableByteArrayContents ba
| ^^^^^^^
cabal: Failed to build haskus-binary-1.4 (which is required by
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.