Giter Site home page Giter Site logo

fclabels's People

Contributors

23skidoo avatar audreyt avatar berberman avatar bergmark avatar elaforge avatar gambogi avatar hesselink avatar phadej avatar ryanglscott avatar sebastiaanvisser avatar shimuuar 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fclabels's Issues

Haddock error in 1.1.7

The latest version of fclabels fails in the Haddock stage:

Setup: dist/doc/html/fclabels/haddock-prolog3783.txt: invalid argument

This probably happens because the description stanza in the Cabal contains something that's not a valid Unicode/UTF-8 character. A complete build log is available at http://hydra.cryp.to:8080/build/6514/nixlog/2/raw.

fclabels-1.1.4 does not build with GHC 7.6 RC1

I just downloaded GHC 7.6 RC1 and tried to build the newest Hackage version of fclabels. This does not work. The error is

Resolving dependencies...
Configuring fclabels-1.1.4...
Building fclabels-1.1.4...
Preprocessing library fclabels-1.1.4...
[1 of 7] Compiling Data.Label.Abstract ( src/Data/Label/Abstract.hs, dist/build/Data/Label/Abstract.o )

src/Data/Label/Abstract.hs:27:12:
    Unexpected type `~>' where type variable expected
    In the declaration of `Point ~> f i o'
cabal: Error: some packages failed to install:
fclabels-1.1.4 failed during the building phase. The exception was:

Sorry, for not attaching a patch and thanks for your help :-)

Support GHC 8.0

GHC 8.0 RC2 ships with template-haskell-2.11.0.0. You have the constraint template-haskell >= 2.2 && < 2.11. Needs loosening to allow installing.

I note you have tested-with GHC==8.0.1, so this might be a late-in-the-day bounds bump from template-haskell.

Help with composition

Hey,
I have a lens such that (C.Definition -> C.Definition) :~> ([C.BlockItem] -> [C.BlockItem]).
And a lens such that (C.BlockItem -> C.BlockItem) :~> ([C.Init] -> [C.Init])

I want to be able to compose them more intuitively.
Here is what I have for when I want to work with them:

fu1 :: Monad m => (BlockItem -> m a) -> m [a]
fu1 f = maybe (return []) (mapM f) $ P.get fundef ctes

fu2 :: Monad m => (Init -> m a) -> m [[a]]
fu2 f = fu1 ((\x -> maybe (return []) (mapM f) $ P.get blockdef x))

fu3 :: Monad m => (Initializer -> m ()) -> m [[()]]
fu3 f = fu2 (\y -> maybe (return ()) f $ P.get initdef y)

So calling fu3 print will print the initdefs inside of blockdefs inside of fundefs, but it is a bit clunky to write it this way.

Do you have any tips on how you would of composed them?

Full source code here: https://gist.github.com/maxpow4h/6944603

Thanks,

fclabels-2.0.3.3 build hangs on ghc-8.6.3/cabal-2.4.1.0 under Windows 10

When I try to build fclabels-2.0.3.3 under ghc-8.6.3 and cabal-2.4.1.0, ghc never finishes compiling Data.Label.Base. (Task manager shows it happily keeps working overnight, until killed.) (This is on Windows 10.)

See output attached.[2]

No problem building fclabels-2.0.3.3 using ghc-8.4.4 and stack resolver lts-12.20. This r/haskell reddit comment [1] indicates that ghc-8.6.2 and earlier versions successfully built fclabels-2.0.3.3 on Windows 10 also, and only had trouble when using ghc-8.6.3.

My use case is the same as in the reddit comment: I'm trying to build HIE on Windows 10. The 8.6.3 target for HIE uses stack resolver lts-13.0, but as I found the problem is the same when trying to build fclabels without stack, using cabal.

I'll stick with building using an earlier ghc but thought I should note the problem.

[1] https://www.reddit.com/r/haskell/comments/a1u9qj/monthly_hask_anything_december_2018/ech9ael
[2] fclabels_build_cabal_output.txt

Compilation fails on armv6hf with ghc-7.4.1 (Template Haskell bracket illegal in a stage-1 compiler)

Resolving dependencies...
Configuring fclabels-2.0.2.2...
Building fclabels-2.0.2.2...
Preprocessing library fclabels-2.0.2.2...
[ 1 of 10] Compiling Data.Label.Point ( src/Data/Label/Point.hs, dist/build/Data/Label/Point.o )
[ 2 of 10] Compiling Data.Label.Poly ( src/Data/Label/Poly.hs, dist/build/Data/Label/Poly.o )
[ 3 of 10] Compiling Data.Label.Mono ( src/Data/Label/Mono.hs, dist/build/Data/Label/Mono.o )
[ 4 of 10] Compiling Data.Label.Derive ( src/Data/Label/Derive.hs, dist/build/Data/Label/Derive.o )

src/Data/Label/Derive.hs:379:25:
Template Haskell bracket illegal in a stage-1 compiler
[| failArrow |]

src/Data/Label/Derive.hs:380:25:
Template Haskell bracket illegal in a stage-1 compiler
[| zeroArrow |]

Is this expected? I installed Haskell through the haskell-platform package.

Support for GHC 9.6

Hi @sebastiaanvisser,
The module Control.Monad.Trans.Error was deprecated a long time ago and finally removed in transformers 0.6 which is shipped with GHC 9.6.
This leads to this error:

[1 of 1] Compiling Main             ( test/TestSuite.hs, dist/build/suite/suite-tmp/Main.dyn_o )

test/TestSuite.hs:26:1: error:
    Could not find module ‘Control.Monad.Trans.Error’
    Perhaps you meant
      Control.Monad.Trans.Writer (from transformers-0.6.1.0)
      Control.Monad.Trans.RWS (from transformers-0.6.1.0)
      Control.Monad.Trans.Cont (from transformers-0.6.1.0)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
26 | import Control.Monad.Trans.Error (Error (noMsg))
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Removing the offending line, another error occurs:

[1 of 1] Compiling Main             ( test/TestSuite.hs, dist/build/suite/suite-tmp/Main.dyn_o )

test/TestSuite.hs:187:8: error: [GHC-39999]
    • No instance for ‘MonadPlus (Either String)’
        arising from a use of ‘mA’
    • In the expression: mA
      In an equation for ‘mA_f’: mA_f = mA
    |
187 | mA_f = mA
    |        ^^

In the relevant file, test/TestSuite.hs, there is the following remark:

-- These instance are needed for the `Failing.Lens String` instance,
-- since that needs a `MonadZero` constraint on `Kleisli (Either String)`,
-- which in turn needs a `MonadPlus (Either String)` constraint.
-- These instances used to exist in transformers but were removed in
-- 0.5.0.0 accidentally, and added in 0.5.2.0. We can probably remove
-- this ifdef after GHC 8 rc3 is released, which will include
-- transformers-0.5.2.0.

#if MIN_VERSION_transformers(0,5,0) && !MIN_VERSION_transformers(0,5,2) && MIN_VERSION_base(4,9,0)
instance (Error e) => Alternative (Either e) where
    empty        = Left noMsg
    Left _ <|> n = n
    m      <|> _ = m

instance Error e => MonadPlus (Either e) where
    mzero            = Left noMsg
    Left _ `mplus` n = n
    m      `mplus` _ = m
#endif

Not quite sure what to make of it. Do you have an idea how to fix this issue?

-- Vekhir

Build failures with GHC 8.10.1

[ 8 of 10] Compiling Data.Label.Base  ( src/Data/Label/Base.hs, dist/build/Data/Label/Base.dyn_o )

src/Data/Label/Base.hs:79:10: error:
    • Couldn't match expected type ‘Poly.Lens
                                      cat (Maybe a -> Maybe b) (a -> b)’
                  with actual type ‘Unit
                                      (Poly.Lens cat0 (Maybe a0 -> Maybe b0) (a0 -> b0))’
    • In the expression:
        (Unit (point
                 $ (Data.Label.Point.Point
                      ((Control.Arrow.zeroArrow Control.Arrow.||| Control.Category.id)
                         Control.Category.<<<
                           arr
                             (\ f
                                -> case f of
                                     Just a -> Right a
                                     _ -> Left ())))
                     ((Data.Label.Derive.modifier
                         ((Control.Arrow.zeroArrow Control.Arrow.||| Control.Category.id)
                            Control.Category.<<<
                              arr
                                (\ f
                                   -> case f of
                                        Just a -> Right a
                                        _ -> Left ())))
                        ((Control.Arrow.zeroArrow Control.Arrow.||| Control.Category.id)
                           Control.Category.<<<
                             arr
                               (\ (v, f)
                                  -> case f of
                                       Just _ -> Right (Just v)
                                       _ -> Left ())))) ::
           forall cat a b.
           (ArrowChoice cat, ArrowApply cat, ArrowZero cat) =>
           Unit Poly.Lens cat (Maybe a -> Maybe b) (a -> b))
      In an equation for ‘just’:
          just
            = (Unit (point
                       $ (Data.Label.Point.Point
                            ((Control.Arrow.zeroArrow Control.Arrow.||| Control.Category.id)
                               Control.Category.<<<
                                 arr
                                   (\ f
                                      -> case f of
                                           Just a -> Right a
                                           _ -> Left ())))
                           ((Data.Label.Derive.modifier
                               ((Control.Arrow.zeroArrow Control.Arrow.||| Control.Category.id)
                                  Control.Category.<<<
                                    arr
                                      (\ f
                                         -> case f of
                                              Just a -> Right a
                                              _ -> Left ())))
                              ((Control.Arrow.zeroArrow Control.Arrow.||| Control.Category.id)
                                 Control.Category.<<<
                                   arr
                                     (\ (v, f)
                                        -> case f of
                                             Just _ -> Right (Just v)
                                             _ -> Left ())))) ::
                 forall cat a b.
                 (ArrowChoice cat, ArrowApply cat, ArrowZero cat) =>
                 Unit Poly.Lens cat (Maybe a -> Maybe b) (a -> b))
    • Relevant bindings include
        just :: Poly.Lens cat (Maybe a -> Maybe b) (a -> b)
          (bound at src/Data/Label/Base.hs:79:1)
   |
79 | just = $(getLabel ''Maybe)
   |          ^^^^^^^^^^^^^^^^

Possibly faster Point

newtype Point m f i o = Point { runPoint :: f -> m (i -> m f, o) }

getSetPoint :: Monad m => (f -> m o) -> (i -> f -> m f) -> Point m f i o
getSetPoint g s = Point $ \f -> do 
  o <- g f
  return (\i -> s i f, o)

_get :: Monad m => Point m f i o -> f -> m o
_get (Point p) = liftM snd . p

_set :: Monad m => Point m f i o -> i -> f -> m f
_set (Point p) i f = do (s, _) <- p f; s i

_modify :: Monad m => Point m f i o -> (o -> m i) -> f -> m f
_modify (Point p) m f = do (s, o) <- p f; (s <=< m) o

instance Monad m => Functor (Point m f i) where
  fmap f (Point p) = Point $ liftM (fmap f) . p

instance Monad m => Applicative (Point m f i) where
  pure a = Point $ \f -> return (const (return f), a)
  Point pf <*> Point pa = Point $ \f -> do
    (fs, fo) <- pf f
    (_ , ao) <- pa f
    return (\i -> do f' <- fs i; (as, _) <- pa f'; as i, fo ao)

bimap :: Monad m => (o' -> m o) -> (i -> m i') -> Point m f i' o' -> Point m f i o
bimap g h p = Point . runKleisli $ (arr (<=< h) *** Kleisli g) . Kleisli (runPoint p)

-XGADTs in GHC 7.0.3 breaks fclabels-1.0.4

This program throws compiler errors:

{-# LANGUAGE GADTs #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}

import Prelude hiding ((.), id)
import Data.Label

data D = A { _a :: () } | B { _b :: Char }

$(mkLabels [''D])

Without line 1 {-# LANGUAGE GADTs #-} there is no problem. What's going on?

GHC 8: Segmentation fault/access violation in generated code

Preprocessing library fclabels-2.0.2.3...
[10 of 10] Compiling Data.Label.Base ( src\Data\Label\Base.hs, dist\build\Data\Label\Base.o )
Segmentation fault/access violation in generated code
cabal: Error: some packages failed to install:
fclabels-2.0.2.3 failed during the building phase. The exception was:
ExitFailure 1

'id' Lens does not work properly

In GHCi with fclabels-1.1.0.1 loaded (along with 'id' from Control.Category loaded):

*Main> get id $ set id 1 2
2

which violates the law

get l (set l a f) == a

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.