-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Haskell --cnf backend produces code with error: Illegal type synonym family application #216
Comments
Could you show some of the context in CnfTablesCalc? Maybe it's a matter of using the right GHC extension. |
Here is some context (not the whole file): {-# LANGUAGE MagicHash, FlexibleInstances #-}
module CnfTablesCalc where
import GHC.Prim
import Control.Applicative hiding (Const)
import Algebra.RingUtils
import Parsing.Chart ()
import AbsCalc
import LexCalc
import PrintCalc
readInteger :: String -> Integer
readInteger = read
readDouble :: String -> Double
readDouble = read
instance RingP [(CATEGORY,Any)] where
mul p a b = trav [map (app tx ty) l :/: map (app tx ty) r | (x,tx) <- a, (y,ty) <- b, let l:/:r = combine p x y]
where trav :: [Pair [a]] -> Pair [a]
trav [] = pure []
trav (x:xs) = (++) <$> x <*> trav xs
app tx ty (z,f) = (z, f tx ty)
showAst (cat,ast) = case cat of
CAT_Exp -> printTree ((unsafeCoerce# ast)::Exp)
_ -> "Unprintable category"
data CATEGORY = CAT_Exp|
CAT_0|
CAT_1|
CAT_Exp1|
CAT_2|
CAT_3|
CAT_Exp2|
CAT_4|
CAT_Integer|
TOK_40|
TOK_41|
TOK_42|
TOK_43|
TOK_45|
TOK_47
deriving (Eq,Ord,Show) |
Looks the
or somesuch. |
What do you mean by type family here?
This looks like a vanilla |
… On Tue, Nov 28, 2017 at 7:21 PM, Andreas Abel ***@***.***> wrote:
What do you mean by type family here?
*Main> :m + Data.Monoid
*Main Data.Monoid> :info Any
newtype Any = Any {getAny :: Bool} -- Defined in ‘Data.Monoid’
instance Bounded Any -- Defined in ‘Data.Monoid’
instance Eq Any -- Defined in ‘Data.Monoid’
instance Ord Any -- Defined in ‘Data.Monoid’
instance Read Any -- Defined in ‘Data.Monoid’
instance Show Any -- Defined in ‘Data.Monoid’
instance Monoid Any -- Defined in ‘Data.Monoid’
This looks like a vanilla newtype to me.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#216 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABsYwc10uFlK8L8wd7z8NBj5FZuzLt3ks5s7E8MgaJpZM4QsGb1>
.
|
Ah, ok, not the I have no experience with |
An alternative to using coerce/Any would be to encode the proper type using
singletons, and the dependent-haskell tricks. I'm not sure that this is a
very good idea though, as it will complicate the generated code for little
benefit.
…On Wed, Nov 29, 2017 at 3:53 PM, Andreas Abel ***@***.***> wrote:
Ah, ok, not the Data.Monoid.Any.
I have no experience with coerce in Haskell, haven't used that Any type
before.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#216 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABsY19Ynb2ASgb4_qVbfRlee3PdHLvvks5s7W_qgaJpZM4QsGb1>
.
|
@jyp Can you give me a date by which you will have fixed this? |
No.
|
With ghc-7.10, the code generated by the Haskell CNF backend does not compile:
yields
The text was updated successfully, but these errors were encountered: