haskellari / indexed-traversable Goto Github PK
View Code? Open in Web Editor NEWFunctorWithIndex, FoldableWithIndex, TraversableWithIndex
FunctorWithIndex, FoldableWithIndex, TraversableWithIndex
There is a new warning with GHC 9.10:
src/WithIndex.hs:264:27: warning: [GHC-12003] [-Wtype-equality-out-of-scope]
• The ‘~’ operator is out of scope.
Assuming it to stand for an equality constraint.
• NB: ‘~’ used to be built-in syntax but now is a regular type operator
exported from Data.Type.Equality and Prelude.
If you are using a custom Prelude, consider re-exporting it.
• This will become an error in a future GHC release.
|
264 | default itraverse :: (i ~ Int, Applicative f) => (i -> a -> f b) -> t a -> f (t b)
|
makes it easier to write a itraverse where the indexing type isnt an Int :)
alternatively expose the default
but parametrized over starting value and increment? (so i can plug in different types)
A base bump to allow 4.16 should be sufficient, at least this succeeds:
cabal install -w ghc-9.2.0 indexed-traversable --allow-newer=indexed-traversable:base
Failed to build indexed-traversable-instances-0.1.1.1.
Build log (
/home/phil/.cabal/logs/ghc-9.0.2/indexed-traversable-instances-0.1.1.1-6405bb3a8c098e0325d7b52aaa3ac3275de7fa82b741b994e2e754541d89f270.log
):
Configuring library for indexed-traversable-instances-0.1.1.1..
Preprocessing library for indexed-traversable-instances-0.1.1.1..
Building library for indexed-traversable-instances-0.1.1.1..
[1 of 1] Compiling Data.Functor.WithIndex.Instances ( src/Data/Functor/WithIndex/Instances.hs, dist/build/Data/Functor/WithIndex/Instances.o, dist/build/Data/Functor/WithIndex/Instances.dyn_o )
ghc: panic! (the 'impossible' happened)
(GHC version 9.0.2:
Ix{Int}.index: Index (4107780713) out of range ((0,83))
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
cabal: Failed to build indexed-traversable-instances-0.1.1.1 (which is
I appreciate that 9.0.2 is a year out of date, but it’s the current ghc release on Debian testing / unstable. Should I report it as a ghc bug as requested, or is 9.0.2 not going to get any more patches at this point? If so I will prod the Debian ghc maintainers...
cheers, Phil
indexed-traversable
compiles with containers 0.7
We have some Word64
-indexed types, and having to scatter fromIntegral
all over to compensate outweighs the convenience of using like ifor_ f xs
over for_ f (xs `zip` [0..])
in a smaller number spots.
WDYT about replacing instance FunctorWithIndex Int []
with instance Integral i => FunctorWithIndex i []
, and so on?
These warnings should be fixed at some point:
Building library for indexed-traversable-0.1.2..
...
[2 of 5] Compiling WithIndex ( src/WithIndex.hs, dist/build/WithIndex.o, dist/build/WithIndex.dyn_o )
src/WithIndex.hs:673:3: warning: [-Wnoncanonical-monoid-instances]
Noncanonical ‘mappend’ definition detected
in the instance declaration for ‘Monoid (Traversed a f)’.
‘mappend’ will eventually be removed in favour of ‘(<>)’
Either remove definition for ‘mappend’ (recommended) or define as ‘mappend = (<>)’
See also: https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/semigroup-monoid
|
673 | Traversed ma `mappend` Traversed mb = Traversed (ma *> mb)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/WithIndex.hs:694:3: warning: [-Wnoncanonical-monoid-instances]
Noncanonical ‘mappend’ definition detected
in the instance declaration for ‘Monoid (Sequenced a m)’.
‘mappend’ will eventually be removed in favour of ‘(<>)’
Either remove definition for ‘mappend’ (recommended) or define as ‘mappend = (<>)’
See also: https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/semigroup-monoid
|
694 | Sequenced ma `mappend` Sequenced mb = Sequenced (ma >> mb)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The latest release on Hackage is earlier than this change.
https://hackage.haskell.org/package/indexed-traversable-instances
Can a revision be published? It will help to build the library on nixpkgs
in the future.
Thank you
This works fine, so I guess the upper bound on base
should be bumped to base < 4.21
:
cabal repl -z -b indexed-traversable==0.1.3 --allow-newer=indexed-traversable:base -w ~/ghc-9.10/bin/ghc-9.10.1
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.