[GHC] #12542: Unexpected failure.. (bug?)
GHC
ghc-devs at haskell.org
Fri Aug 26 01:56:06 UTC 2016
#12542: Unexpected failure.. (bug?)
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by Iceland_jack:
@@ -2,2 +2,2 @@
- slides.pdf A Generic Abstract Syntax Model for Embedded
- Languages]([http://www.cse.chalmers.se/~emax/documents/axelsson2012generic.pdf
+ slides.pdf A Generic Abstract Syntax Model for Embedded Languages]
+ ([http://www.cse.chalmers.se/~emax/documents/axelsson2012generic.pdf
@@ -30,1 +30,1 @@
- and so does
+ works, and so does
New description:
From [http://www.cse.chalmers.se/~emax/documents/axelsson2012generic-
slides.pdf A Generic Abstract Syntax Model for Embedded Languages]
([http://www.cse.chalmers.se/~emax/documents/axelsson2012generic.pdf
paper])
{{{#!hs
infixr :->
infixl 1 :$
data Full a
data a :-> b
data AST dom sig where
Sym :: dom sig -> AST dom sig
(:$) :: AST dom (a :-> sig) -> AST dom (Full a) -> AST dom sig
class Binding dom where
viewVar :: dom a -> Maybe Integer
viewBnd :: dom (a :-> b) -> Maybe Integer
freeVars :: Binding dom => AST dom a -> [Integer]
freeVars = \case
Sym (a -> Just v) -> [v]
Sym (b -> Just v) :$ body -> undefined
where
(a, _) = (viewVar, undefined)
(_, b) = (undefined, viewBnd)
}}}
works, and so does
{{{#!hs
where
a = viewVar
b = viewBnd
}}}
but
{{{#!hs
where
(a, b) = (viewVar, viewBnd)
}}}
yields
{{{
tSvp.hs:20:5-31: error: …
• Could not deduce (Binding dom0)
from the context: Binding dom
bound by the type signature for:
freeVars :: Binding dom => AST dom a -> [Integer]
at /tmp/tSvp.hs:14:1-49
or from: Binding dom2
bound by the inferred type for ‘a’:
Binding dom2 => dom2 a1 -> Maybe Integer
at /tmp/tSvp.hs:20:5-31
The type variable ‘dom0’ is ambiguous
• When checking that the inferred type
a :: forall k k1 (dom :: * -> *) a (dom1 :: *
-> *) (a1 :: k) (b ::
k1).
(Binding dom1, Binding dom) =>
dom a -> Maybe Integer
is as general as its inferred signature
a :: forall (dom :: * -> *) a.
Binding dom =>
dom a -> Maybe Integer
In an equation for ‘freeVars’:
freeVars
= \case {
Sym (a -> Just v) -> [v]
Sym (b -> Just v) :$ body -> undefined }
where
(a, b) = (viewVar, viewBnd)
tSvp.hs:20:5-31: error: …
• Could not deduce (Binding dom1)
from the context: Binding dom
bound by the type signature for:
freeVars :: Binding dom => AST dom a -> [Integer]
at /tmp/tSvp.hs:14:1-49
or from: Binding dom2
bound by the inferred type for ‘b’:
Binding dom2 => dom2 (a1 :-> b) -> Maybe Integer
at /tmp/tSvp.hs:20:5-31
The type variable ‘dom1’ is ambiguous
• When checking that the inferred type
b :: forall k k1 (dom :: * -> *) a (dom1 :: *
-> *) (a1 :: k) (b ::
k1).
(Binding dom1, Binding dom) =>
dom1 (a1 :-> b) -> Maybe Integer
is as general as its inferred signature
b :: forall k k1 (dom :: * -> *) (a :: k) (b :: k1).
Binding dom =>
dom (a :-> b) -> Maybe Integer
In an equation for ‘freeVars’:
freeVars
= \case {
Sym (a -> Just v) -> [v]
Sym (b -> Just v) :$ body -> undefined }
where
(a, b) = (viewVar, viewBnd)
Compilation failed.
}}}
Is this intentional?
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12542#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list