frerich / catamorphism Goto Github PK
View Code? Open in Web Editor NEWA package exposing a function for generating catamorphisms.
License: BSD 3-Clause "New" or "Revised" License
A package exposing a function for generating catamorphisms.
License: BSD 3-Clause "New" or "Revised" License
Hi,
I would love to use this great package, but unfortunately the build fails with GHC 8.0.2, because of the following unsatisfyable constraints:
base >=4.6 && <4.9, template-haskell >=2.8 && <2.11
I suppose similar issues would exist with GHC 8.2.1.
Would it be possible to get an updated version of this package that remedies this issue, i.e. by means of http://hackage.haskell.org/package/th-abstraction?
Best regards,
Peter
Given a standard rose tree definition as in
{-# LANGUAGE TemplateHaskell #-}
import Data.Morphism.Cata
data RoseTree a = Node a [RoseTree a]
$(makeCata defaultOptions ''RoseTree)
main = return ()
makeCata
as of catamorphism 0.5.0.1 generates the following (incorrect!) function:
λ: :t roseTree
roseTree :: (a1 -> [RoseTree a1] -> a0) -> RoseTree a1 -> a0
The actual type of the catamorphism should have been
roseTree :: (a1 -> [a0] -> a0) -> RoseTree a1 -> a0
It appears that makeCata
doesn't realize that it could map the catamorphism over the list. In fact, it could probably do that for every type which instantiates Foldable
?
Illegal kind signature: ‘ghc-prim-0.5.1.1:GHC.Types.Type’
Perhaps you intended to use KindSignatures
In the type signature for ‘cataProp’
|
40 | $(makeCata defaultOptions { cataName = "cataProp" } ''Proposition)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I'm not sure if this is behaviour that you have observed, but if so, it may be worth adding a word about it in the documentation.
Build on GHC 7.10.1 fails because of the base
bound:
$ cabal install catamorphism
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: catamorphism-0.3.0.0 (user goal)
next goal: base (dependency of catamorphism-0.3.0.0)
rejecting: base-4.8.0.0/installed-901... (conflict: catamorphism => base>=4.6
&& <4.8)
rejecting: base-4.8.0.0, 4.7.0.2, 4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0, 4.5.1.0,
4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1, 4.2.0.0,
4.1.0.0, 4.0.0.0, 3.0.3.2, 3.0.3.1 (global constraint requires installed
instance)
Using catamorphism 0.5.0.1, the following program fails to compile:
{-# LANGUAGE TemplateHaskell #-}
import Data.Morphism.Cata
data List a = Empty | Cons a (List (List a))
$(makeCata defaultOptions ''List)
main = return ()
The makeCata
invocation generates code yielding the error message
treecata.hs:6:3:
Couldn't match type ‘a1’ with ‘List a1’
‘a1’ is a rigid type variable bound by
the type signature for list :: a -> (a1 -> a -> a) -> List a1 -> a
at treecata.hs:6:3
Expected type: List a1
Actual type: List (List a1)
Relevant bindings include
a_a2p8 :: List (List a1) (bound at treecata.hs:6:3)
a_a2p7 :: a1 (bound at treecata.hs:6:3)
x_a2p6 :: List a1 (bound at treecata.hs:6:3)
c_a2p5 :: a1 -> a -> a (bound at treecata.hs:6:3)
list :: a -> (a1 -> a -> a) -> List a1 -> a
(bound at treecata.hs:6:3)
In the third argument of ‘list’, namely ‘a_a2p8’
In the second argument of ‘c_a2p5’, namely
‘list c_a2p4 c_a2p5 a_a2p8’
The build seems to work fine when the constraints on base
and template-haskell
are relaxed.
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.