Giter VIP home page Giter VIP logo

catamorphism's People

Contributors

frerich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

catamorphism's Issues

Support for recent versions of GHC?

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

Catamorphism generated for rose tree (e.g. Data.Tree.Tree) is incorrect

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?

Build fails without KindSignatures

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.

Update to GHC 7.10.1

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)

Code generated for non-regular recursive types does not typecheck

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’

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.