medeamelana / stack-prism Goto Github PK
View Code? Open in Web Editor NEWHaskell lens prisms that use stack types
License: Other
Haskell lens prisms that use stack types
License: Other
If you only import Data.StackPrism.TH
(without also importing Data.StackPrism
), and then use any of the TH methods, you will get type errors (StackPrism
not defined). Not a huge deal but a bit confusing.
Data/StackPrism/TH.hs:81:7:
parse error on input ‘-- *, such as that of Maybe, are now KindedTVs instead of PlainTVs. If we’
Tried on #5.
without commenting out the offending tests:
[2 of 3] Compiling TestGeneric ( tests/TestGeneric.hs, .stack-work/dist/x86_64-linux-nopie/Cabal-2.0.1.0/build/tests/tests-tmp/TestGeneric.o )
/home/mf/src/stack-prism/tests/TestGeneric.hs:25:1: error:
Overloaded signature conflicts with monomorphism restriction
person :: forall t.
StackPrism
(String :- (Gender :- (Int :- (Coords :- t)))) (Person :- t)
|
25 | person :: StackPrism (String :- Gender :- Int :- Coords :- t) (Person :- t)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[...]
with -XNoMonomorphismRestriction
:
[2 of 3] Compiling TestGeneric ( tests/TestGeneric.hs, .stack-work/dist/x86_64-linux-nopie/Cabal-2.0.1.0/build/tests/tests-tmp/TestGeneric.o )
/home/mf/src/stack-prism/tests/TestGeneric.hs:32:1: error:
• Could not deduce (Applicative f4)
from the context: (profunctors-5.2.2:Data.Profunctor.Choice.Choice
p,
Applicative f)
bound by the inferred type for ‘male’:
forall t. StackPrism t (Gender :- t)
at tests/TestGeneric.hs:32:1-66
The type variable ‘f4’ is ambiguous
• When checking that the inferred type
male :: forall (p1 :: * -> * -> *) (p2 :: * -> * -> *) (f1 :: *
-> *) (f2 :: * -> *) t1 t2.
(Applicative f2, Applicative f1,
profunctors-5.2.2:Data.Profunctor.Choice.Choice p2,
profunctors-5.2.2:Data.Profunctor.Choice.Choice p1) =>
p1 t1 (f1 t1) -> p1 (Gender :- t1) (f1 (Gender :- t1))
is as general as its signature
male :: forall t. StackPrism t (Gender :- t)
|
32 | PrismList (P male :& P female) = mkPrismList :: StackPrisms Gender
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[...]
When trying to compile ide-backend-client with GHC 7.10.
src/IdeSession/Client/JsonAPI.hs:1:1:
Exception when trying to run compile-time code:
Data/StackPrism/TH.hs:74:27-63: Non-exhaustive patterns in lambda
Code: deriveStackPrismsWith prismNameForConstructor ''Maybe
This is because you are just ignoring the KindedTV
case. Apparently ghc changed it's output in one case from a PlainTV to a KindedTV which caused the problem in ide-backend-client, but that pattern match was not exhaustive even before GHC 7.10.
Chris Done figured out a minimal example of how the output changed:
GHC 7.8.4:
Prelude Language.Haskell.TH> putStrLn $(reify ''Maybe >>= stringE . show)
TyConI (DataD [] Data.Maybe.Maybe [PlainTV a_1627399042]
[NormalC Data.Maybe.Nothing [],NormalC Data.Maybe.Just [(NotStrict,VarT a_1627399042)]]
[])
GHC 7.10:
Prelude Language.Haskell.TH> putStrLn $(reify ''Maybe >>= stringE . show)
TyConI (DataD [] GHC.Base.Maybe [KindedTV a_1627404217 StarT]
[NormalC GHC.Base.Nothing [],NormalC GHC.Base.Just [(NotStrict,VarT a_1627404217)]]
[])
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.