Code Monkey home page Code Monkey logo

Comments (5)

rubik avatar rubik commented on May 26, 2024

Thanks for the report! I'll look into it.

from argon.

rubik avatar rubik commented on May 26, 2024

I think that CPP is somehow messing up the code. The following raises the error:

{-# LANGUAGE CPP #-}
#ifndef HLINT
{-# LANGUAGE ViewPatterns #-}
#endif
{-# LANGUAGE PatternSynonyms #-}

data Counted a = Counted Int [a]
               deriving (Functor, Traversable, Eq, Ord, Read, Show)

pattern (:+) :: () => () => a -> Counted a -> Counted a
pattern a :+ as <- Counted (subtract 1 -> i) (a : (Counted i -> as)) where
  a :+ Counted i as = Counted (i+1) (a:as)

while this one does not

{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE PatternSynonyms #-}

data Counted a = Counted Int [a]
               deriving (Functor, Traversable, Eq, Ord, Read, Show)

pattern (:+) :: () => () => a -> Counted a -> Counted a
pattern a :+ as <- Counted (subtract 1 -> i) (a : (Counted i -> as)) where
  a :+ Counted i as = Counted (i+1) (a:as)

I also noticed that CPP-related errors sometimes show up when the syntax is correct.

from argon.

rubik avatar rubik commented on May 26, 2024

Now all files from the lens and concurrent packages are parsed correctly.
The only exception to this rule are C macros of the form __MIN_VERSION_{package}__ which are provided by Cabal and I have yet to figure out how to support them.

from argon.

ekmett avatar ekmett commented on May 26, 2024

One option for MIN_VERSION_foo would be to fake them by rummaging through
the package database (or just the output of ghc-pkg list) and taking the
latest version of each as a conservative over-approximation.

That doesn't really help scenarios like stack that avoid using the global
package DB though, there you'd need to find the current sandbox.

On Thu, Oct 29, 2015 at 6:08 AM, Michele Lacchia [email protected]
wrote:

Now all files from the lens and concurrent packages are parsed correctly.
The only exception to this rule are C macros of the form
MIN_VERSION_{package} which are provided by Cabal and I have yet to
figure out how to support them.


Reply to this email directly or view it on GitHub
#14 (comment).

from argon.

rubik avatar rubik commented on May 26, 2024

I was hoping that the cabal library had some functions to work with this. I have yet to investigate the issue though.

from argon.

Related Issues (20)

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.