GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T19:18:33Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/304ghc hangs during compilation2019-07-07T19:18:33Znobodyghc hangs during compilation```
The following code causes both ghc-6.4.20050209 and
ghc-6.2.2 to hang during compilation.
newtype S = S { unS :: S -> S }
y :: S -> S
y (S f) = g (S g) where g h = f (unS h h)
Thomas Jäger <ThJaeger@gmail.com>
```
<details><summ...```
The following code causes both ghc-6.4.20050209 and
ghc-6.2.2 to hang during compilation.
newtype S = S { unS :: S -> S }
y :: S -> S
y (S f) = g (S g) where g h = f (unS h h)
Thomas Jäger <ThJaeger@gmail.com>
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | None |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedNoReason |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"ghc hangs during compilation","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedNoReason","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"None","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nThe following code causes both ghc-6.4.20050209 and\nghc-6.2.2 to hang during compilation.\n\nnewtype S = S { unS :: S -> S }\n\ny :: S -> S\ny (S f) = g (S g) where g h = f (unS h h)\n\n\nThomas Jäger <ThJaeger@gmail.com>\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->nobodynobodyhttps://gitlab.haskell.org/ghc/ghc/-/issues/303Rebindable syntax doesn't work as advertised2019-07-07T19:18:33ZnobodyRebindable syntax doesn't work as advertised```
--
-- According to section 7.3.5. Rebindable syntax in the
user's manual
-- this should work (unless I totally misunderstood it).
-- It doesn't.
--
-- Compile with -fno-implicit-prelude
--
-- Lennart
--
import Prelude hiding(Mon...```
--
-- According to section 7.3.5. Rebindable syntax in the
user's manual
-- this should work (unless I totally misunderstood it).
-- It doesn't.
--
-- Compile with -fno-implicit-prelude
--
-- Lennart
--
import Prelude hiding(Monad(..))
class B a where
b :: a
instance B Bool where
b = False
class M m where
return :: a -> m a
(>>=) :: (B a) => m a -> (a -> m b) -> m b
(>>) :: (B a) => m a -> m b -> m b
fail :: String -> m a
p >> q = p >>= \ _ -> q
fail s = error s
instance M Maybe where
return x = Just x
(>>=) = error "bind"
test :: Maybe Bool
test = do
x <- return True
return (x && x)
unJust (Just x) = x
main = print (unJust test)
```nobodynobodyhttps://gitlab.haskell.org/ghc/ghc/-/issues/301GADT constructor constraints ignored2021-09-24T11:49:26Zwolfram_kahlGADT constructor constraints ignored```
Class constraints on GADT constructore appear to be
ignored.
I tried:
data Expr :: * -> * where
Const :: Show a => a -> Expr a
Apply :: Fct a b -> Expr a -> Expr b
and there is no way to define the expected constraint-less
Sho...```
Class constraints on GADT constructore appear to be
ignored.
I tried:
data Expr :: * -> * where
Const :: Show a => a -> Expr a
Apply :: Fct a b -> Expr a -> Expr b
and there is no way to define the expected constraint-less
Show instance --- for details, see Expr0.lhs.
```6.8.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/289class context restrictions in GADT types not assumed2019-07-07T19:18:38Zashley-yclass context restrictions in GADT types not assumed```
I think this should compile:
class C a where
f :: a -> Bool
data T a where
MkT :: (C a) => a -> T a
tf1 :: T Int -> Bool
tf1 (MkT aa) = f aa
tf2 :: T a -> Bool
tf2 (MkT aa) = f aa
tf1 does not give an error, but tf2 do...```
I think this should compile:
class C a where
f :: a -> Bool
data T a where
MkT :: (C a) => a -> T a
tf1 :: T Int -> Bool
tf1 (MkT aa) = f aa
tf2 :: T a -> Bool
tf2 (MkT aa) = f aa
tf1 does not give an error, but tf2 does. The type signature for tf2
should not need a class context, just as there's no "C Int" instance.
ThingEncoding.hs:32:23:
No instance for (C a)
arising from use of `f' at ThingEncoding.hs:32:23
Probable fix: Add (C a) to the type signature(s) for `tf2'
In the definition of `tf2': tf2 (MkT aa) = f aa
```6.8.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/214ghc "panic" - typecheck/TcRnTypes.lhs:2332019-07-07T19:19:07Zfergusghc "panic" - typecheck/TcRnTypes.lhs:233```
I got a ghc "panic" when trying to compile some code
which made use of .hi-boot files. The exact panic
message was
ghc-6.0.1: panic! (the `impossible' happened, GHC
version 6.0.1):
typecheck/TcRnTypes.lhs:233: Missing field...```
I got a ghc "panic" when trying to compile some code
which made use of .hi-boot files. The exact panic
message was
ghc-6.0.1: panic! (the `impossible' happened, GHC
version 6.0.1):
typecheck/TcRnTypes.lhs:233: Missing field in
record construction TcRnTypes.top_errs
This was on a RedHat 8.0 Linux system,
with the following version of ghc:
Glasgow Haskell Compiler, Version 6.0.1, for Haskell
98, compiled by GHC version 6.0
I apologize for the incompleteness of this bug report,
but unfortunately the source code which triggered this
bug is proprietary, so I can't include it here. Sorry!
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedFixed |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"ghc \"panic\" - typecheck/TcRnTypes.lhs:233","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"simonpj"},"version":"6.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nI got a ghc \"panic\" when trying to compile some code\nwhich made use of .hi-boot files. The exact panic\nmessage was\n\nghc-6.0.1: panic! (the `impossible' happened, GHC\nversion 6.0.1):\n typecheck/TcRnTypes.lhs:233: Missing field in\nrecord construction TcRnTypes.top_errs\n\nThis was on a RedHat 8.0 Linux system,\nwith the following version of ghc:\nGlasgow Haskell Compiler, Version 6.0.1, for Haskell\n98, compiled by GHC version 6.0\n\nI apologize for the incompleteness of this bug report,\nbut unfortunately the source code which triggered this\nbug is proprietary, so I can't include it here. Sorry!\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/189Malformed Predicate w/ Template Haskell2019-07-07T19:19:13ZjcastMalformed Predicate w/ Template Haskell```
The following two modules:
--- Cut ---
module ScratchTemplates where
import Language.Haskell.THSyntax
newtype Interaction a = Interaction a deriving Show
ret = Interaction
instance Monad Interaction where
return = Interactio...```
The following two modules:
--- Cut ---
module ScratchTemplates where
import Language.Haskell.THSyntax
newtype Interaction a = Interaction a deriving Show
ret = Interaction
instance Monad Interaction where
return = Interaction
Interaction x >>= f = f x
instance Functor Interaction where
fmap f x = x >>= return . f
interactionT t = tcon (TconName "Interaction") `tapp` t
class Flatten a b | a -> b where
flatten :: a -> b
flattenT :: TypQ -> TypQ -> TypQ
flattenT t t' = tvar "Flatten" `tapp` t `tapp` t
baseType t = sequence [
inst (return []) (flattenT t t)
[val (pvar "flatten") (normal (var "id")) []],
inst (return []) (flattenT (interactionT t)
(interactionT t))
[val (pvar "flatten") (normal (var "id")) []]]
instance Flatten a b =>
Flatten (Interaction (Interaction a))
(Interaction b) where
flatten a = a >>= id >>= return . flatten
module Main where
import Monad
import ScratchTemplates
import Language.Haskell.THSyntax
$(baseType (tcon (Tuple 0)))
instance Flatten String String where
flatten a = a
instance Flatten (Interaction String) (Interaction
String) where
flatten a = a
instance Flatten b c => Combine String b (String, c) where
combine a b = liftM2 (,) a (fmap flatten b)
instance Flatten Int Int where
flatten a = a
class Combine a b c | a b -> c where
combine :: Interaction a -> Interaction b ->
Interaction c
instance Combine () b b where
combine a b = b
instance Flatten b c => Combine Int b (Int, c) where
combine a b = do
x <- a
y <- fmap flatten b
return (x, y)
instance (Flatten b c, Combine a c d) =>
Flatten (Interaction a, Interaction b)
(Interaction d) where
flatten (a, b) = combine a (fmap flatten b)
main = main
--- Cut here ---
loaded into ghci -fglasgow-exts produce the following
error message:
Compiling ScratchTemplates ( ScratchTemplates.hs,
interpreted )
Compiling Main ( scratch.hs, interpreted )
ghc-6.0.1: panic! (the `impossible' happened, GHC
version 6.0.1):
Malformed predicate
Please report it as a compiler bug to
glasgow-haskell-bugs@haskell.org,
or http://sourceforge.net/projects/ghc/.
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedFixed |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Malformed Predicate w/ Template Haskell","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"6.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nThe following two modules:\n\n --- Cut ---\n\nmodule ScratchTemplates where\n\nimport Language.Haskell.THSyntax\n\nnewtype Interaction a = Interaction a deriving Show\n\nret = Interaction\n\ninstance Monad Interaction where\n return = Interaction\n Interaction x >>= f = f x\n\ninstance Functor Interaction where\n fmap f x = x >>= return . f\n\ninteractionT t = tcon (TconName \"Interaction\") `tapp` t\n\nclass Flatten a b | a -> b where\n flatten :: a -> b\n\nflattenT :: TypQ -> TypQ -> TypQ\nflattenT t t' = tvar \"Flatten\" `tapp` t `tapp` t\n\nbaseType t = sequence [\n inst (return []) (flattenT t t)\n [val (pvar \"flatten\") (normal (var \"id\")) []],\n inst (return []) (flattenT (interactionT t)\n(interactionT t))\n [val (pvar \"flatten\") (normal (var \"id\")) []]]\n\ninstance Flatten a b =>\n Flatten (Interaction (Interaction a))\n(Interaction b) where\n flatten a = a >>= id >>= return . flatten\n\nmodule Main where\n\nimport Monad\nimport ScratchTemplates\nimport Language.Haskell.THSyntax\n\n$(baseType (tcon (Tuple 0)))\n\ninstance Flatten String String where\n flatten a = a\n\ninstance Flatten (Interaction String) (Interaction\nString) where\n flatten a = a\n\ninstance Flatten b c => Combine String b (String, c) where\n combine a b = liftM2 (,) a (fmap flatten b)\n\ninstance Flatten Int Int where\n flatten a = a\n\nclass Combine a b c | a b -> c where\n combine :: Interaction a -> Interaction b ->\nInteraction c\n\ninstance Combine () b b where\n combine a b = b\n\ninstance Flatten b c => Combine Int b (Int, c) where\n combine a b = do\n x <- a\n y <- fmap flatten b\n return (x, y)\n\ninstance (Flatten b c, Combine a c d) =>\n Flatten (Interaction a, Interaction b)\n(Interaction d) where\n flatten (a, b) = combine a (fmap flatten b)\n\nmain = main\n\n --- Cut here ---\n\nloaded into ghci -fglasgow-exts produce the following\nerror message:\n\nCompiling ScratchTemplates ( ScratchTemplates.hs,\ninterpreted )\nCompiling Main ( scratch.hs, interpreted )\nghc-6.0.1: panic! (the `impossible' happened, GHC\nversion 6.0.1):\n\tMalformed predicate\n\nPlease report it as a compiler bug to\nglasgow-haskell-bugs@haskell.org,\nor http://sourceforge.net/projects/ghc/.\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->nobodynobodyhttps://gitlab.haskell.org/ghc/ghc/-/issues/179Instance match failure on openTypeKind2019-07-07T19:19:16ZSimon Peyton JonesInstance match failure on openTypeKind```
Consider
instance Show (a->b) where ...
foo x = show (\ _ -> True)
This fails with:
No instance for (Show (t -> Bool))
arising from use of `show' at Foo.hs:5
Reason: the type of (\_ -> True) is (t -> Bool) whe...```
Consider
instance Show (a->b) where ...
foo x = show (\ _ -> True)
This fails with:
No instance for (Show (t -> Bool))
arising from use of `show' at Foo.hs:5
Reason: the type of (\_ -> True) is (t -> Bool) where
t has an "openTypeKind". It's possible that the function
will be applied to say an Int#, and the openTypeKind
records that this is OK.
BUT, the instance decl Show (a->b) has
a::liftedTypeKind, and that doesn't match an
openTypeKind type variable.
This bug relates to GHC's unsatisfactory treatment of
the variants of kind "type", for which there are at least 2
other SourceForge bugs registered (753780 and
753777). It's very obscure, so I'm not going to fix it
today.
```6.8.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/154mutiparameter classes problem2019-07-07T19:19:22Znobodymutiparameter classes problem```
hello,
i have run into something that looks like a bug in ghc 6.0.
here is an example:
> module A where
> class C a b where f :: a -> b
> g x = fst (f x)
for this program hugs reports that "g" has an ambiguous
type:
C a (b,c) => ...```
hello,
i have run into something that looks like a bug in ghc 6.0.
here is an example:
> module A where
> class C a b where f :: a -> b
> g x = fst (f x)
for this program hugs reports that "g" has an ambiguous
type:
C a (b,c) => a -> b
which seems reasonable.
however ghc does not report an error, and infers the
following type:
C a (b, ()) => a -> b
(i have changed the formatting for easier comparing).
it seems that somehow the second component of the tuple
became (),
but i don't see why.
bye
iavor
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 6.0 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedFixed |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"mutiparameter classes problem","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"6.0","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nhello,\ni have run into something that looks like a bug in ghc 6.0.\nhere is an example:\n\n> module A where\n> class C a b where f :: a -> b\n> g x = fst (f x)\n\nfor this program hugs reports that \"g\" has an ambiguous\ntype:\n C a (b,c) => a -> b\nwhich seems reasonable.\nhowever ghc does not report an error, and infers the\nfollowing type:\n C a (b, ()) => a -> b\n(i have changed the formatting for easier comparing).\nit seems that somehow the second component of the tuple\nbecame (),\nbut i don't see why.\n\nbye\niavor\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->nobodynobodyhttps://gitlab.haskell.org/ghc/ghc/-/issues/152(->) used prefix doesn't work with unboxed kinds2019-07-07T19:19:22ZSimon Peyton Jones(->) used prefix doesn't work with unboxed kinds```
This fails, but should succeed
f :: (->) Int# Int#
f x = x
-- Here's the comment from TypeRep:
--
-- funTyCon = mkFunTyCon funTyConName
-- (mkArrowKinds [liftedTypeKind,
liftedTypeKind]
-- liftedTypeKind)
-- You might...```
This fails, but should succeed
f :: (->) Int# Int#
f x = x
-- Here's the comment from TypeRep:
--
-- funTyCon = mkFunTyCon funTyConName
-- (mkArrowKinds [liftedTypeKind,
liftedTypeKind]
-- liftedTypeKind)
-- You might think that (->) should have type (? -> ? ->
*), and you'd be right
-- But if we do that we get kind errors when saying
-- instance Control.Arrow (->)
-- becuase the expected kind is (*->*->*). The trouble
is that the
-- expected/actual stuff in the unifier does not go
contra-variant, whereas
-- the kind sub-typing does. Sigh. It really only
matters if you use (->) in
-- a prefix way, thus: (->) Int# Int#. And this is
unusual.
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | None |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedFixed |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"(->) used prefix doesn't work with unboxed kinds","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"None","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nThis fails, but should succeed\n f :: (->) Int# Int#\n f x = x\n\n\n-- Here's the comment from TypeRep:\n--\n-- funTyCon = mkFunTyCon funTyConName \n--\t\t(mkArrowKinds [liftedTypeKind, \nliftedTypeKind]\n--\t\t\t\tliftedTypeKind)\n-- You might think that (->) should have type (? -> ? -> \n*), and you'd be right\n-- But if we do that we get kind errors when saying\n--\tinstance Control.Arrow (->)\n-- becuase the expected kind is (*->*->*). The trouble \nis that the\n-- expected/actual stuff in the unifier does not go \ncontra-variant, whereas\n-- the kind sub-typing does. Sigh. It really only \nmatters if you use (->) in\n-- a prefix way, thus: (->) Int# Int#. And this is \nunusual.\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->nobodynobodyhttps://gitlab.haskell.org/ghc/ghc/-/issues/151Unboxed tuples as values2019-07-07T19:19:22ZSimon Peyton JonesUnboxed tuples as values```
Consider
type T a = Int -> (# Int, Int #)
f :: T a -> T a
f t = \x -> case t x of r -> r
gives the following error message:
ghc-5.04.1: panic! (the `impossible' happened, GHC
version 5.04.1):
codeGen/CgRetConv.lhs:83:...```
Consider
type T a = Int -> (# Int, Int #)
f :: T a -> T a
f t = \x -> case t x of r -> r
gives the following error message:
ghc-5.04.1: panic! (the `impossible' happened, GHC
version 5.04.1):
codeGen/CgRetConv.lhs:83: Non-exhaustive
patterns in function
dataReturnConvPrim
Trouble is that 'r' is bound to an unboxed tuple. This
should fail, but in 5.04.1 it crashes the compiler. In 6.0
it's worse: the code will core dump because it enters R1.
But it should be rejected in the type checker.
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | None |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedFixed |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Unboxed tuples as values","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"None","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nConsider\n\n type T a = Int -> (# Int, Int #)\n\n f :: T a -> T a\n f t = \\x -> case t x of r -> r\n\ngives the following error message:\n\n ghc-5.04.1: panic! (the `impossible' happened, GHC \nversion 5.04.1):\n\t codeGen/CgRetConv.lhs:83: Non-exhaustive \npatterns in function\n\t dataReturnConvPrim\n\nTrouble is that 'r' is bound to an unboxed tuple. This \nshould fail, but in 5.04.1 it crashes the compiler. In 6.0 \nit's worse: the code will core dump because it enters R1.\n\nBut it should be rejected in the type checker.\n\n\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->nobodynobodyhttps://gitlab.haskell.org/ghc/ghc/-/issues/102can't declare instance for type synonim2019-07-07T19:19:37Zalarcan't declare instance for type synonim```
Trying to load into GHCi simple program (in attached
file) I receive error stating I can declare class instances
only for types defined using "data". I beleive it is a bug
because Hugs handles this situation normally.
Error messag...```
Trying to load into GHCi simple program (in attached
file) I receive error stating I can declare class instances
only for types defined using "data". I beleive it is a bug
because Hugs handles this situation normally.
Error message:
/igor/tst.hs:1:
No instance for `Eq (Stack -> Stack)'
When deriving the `Eq' instance for type `Object'
/igor/tst.hs:1:
No instance for `Show (Stack -> Stack)'
When deriving the `Show' instance for type `Object'
/igor/tst.hs:4:
Illegal instance declaration for `Eq Operator'
(The instance type must be of form (T a b c)
where T is not a synonym, and a,b,c are distinct
type variables)
In the instance declaration for `Eq Operator'
/igor/tst.hs:6:
Illegal instance declaration for `Show Operator'
(The instance type must be of form (T a b c)
where T is not a synonym, and a,b,c are distinct
type variables)
In the instance declaration for `Show Operator'
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | None |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedRejected |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"can't declare instance for type synonim","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedRejected","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"None","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nTrying to load into GHCi simple program (in attached \nfile) I receive error stating I can declare class instances \nonly for types defined using \"data\". I beleive it is a bug \nbecause Hugs handles this situation normally.\nError message:\n/igor/tst.hs:1:\n No instance for `Eq (Stack -> Stack)'\n When deriving the `Eq' instance for type `Object'\n\n/igor/tst.hs:1:\n No instance for `Show (Stack -> Stack)'\n When deriving the `Show' instance for type `Object'\n\n/igor/tst.hs:4:\n Illegal instance declaration for `Eq Operator'\n (The instance type must be of form (T a b c)\n where T is not a synonym, and a,b,c are distinct \ntype variables)\n In the instance declaration for `Eq Operator'\n\n/igor/tst.hs:6:\n Illegal instance declaration for `Show Operator'\n (The instance type must be of form (T a b c)\n where T is not a synonym, and a,b,c are distinct \ntype variables)\n In the instance declaration for `Show Operator'\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->nobodynobodyhttps://gitlab.haskell.org/ghc/ghc/-/issues/91panic with linear implicit parameters2019-07-07T19:19:39Zajkpanic with linear implicit parameters```
Observe:
$ ghc -fglasgow-exts -c Unique.hs
ghc-5.04: panic! (the `impossible' happened, GHC
version 5.04):
tcSplitTyConApp {%uniqueSupply{-rF4-} ::
Unique.UniqueSupply{-r7-}}
Please report it as a compiler bug to
glasgow-ha...```
Observe:
$ ghc -fglasgow-exts -c Unique.hs
ghc-5.04: panic! (the `impossible' happened, GHC
version 5.04):
tcSplitTyConApp {%uniqueSupply{-rF4-} ::
Unique.UniqueSupply{-r7-}}
Please report it as a compiler bug to
glasgow-haskell-bugs@haskell.org,
or http://sourceforge.net/projects/ghc/.
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | None |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedFixed |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"panic with linear implicit parameters","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"None","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nObserve:\n\n$ ghc -fglasgow-exts -c Unique.hs\nghc-5.04: panic! (the `impossible' happened, GHC\nversion 5.04):\n tcSplitTyConApp {%uniqueSupply{-rF4-} ::\nUnique.UniqueSupply{-r7-}}\n\nPlease report it as a compiler bug to\nglasgow-haskell-bugs@haskell.org,\nor http://sourceforge.net/projects/ghc/.\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->nobodynobodyhttps://gitlab.haskell.org/ghc/ghc/-/issues/67Signature context in recursive groups2019-07-07T19:19:47ZnobodySignature context in recursive groups```
Hello,
I have a problem with signature contexts in mutually
recursive groups. I want to write a scanner, which is
able to read inputs of the form "int(3)" or
"float(2,0)" and return corresponding values of the
datatype:
data Token ...```
Hello,
I have a problem with signature contexts in mutually
recursive groups. I want to write a scanner, which is
able to read inputs of the form "int(3)" or
"float(2,0)" and return corresponding values of the
datatype:
data Token = TInt Int
| TFloat Float
deriving (Read,Show)
Both constructors have the same type. Therefore, I want
to pass them to another function, which reads the
corresponding number with the function reads:
scan :: String -> [Token]
scan ('i':'n':'t':str) = scanNumber TInt str
scan ('f':'l':'o':'a':'t':str) = scanNumber TInt str
scanNumber :: Read a => (a -> Token) -> String ->
[Token]
scanNumber tokenCons ('(':str) = case reads str of
((n,(')':str1)):_) -> tokenCons
n:scan str1
_ -> error "no literal"
main = print (scan "int(4)")
In Hugs this program works fine, but ghc does not
accept it, because of a mutually recursive group. Is
this a feature or a bug?
What does the Haskell 98 standard say?
Thanks and regards,
Frank Huch
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 5.0 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedWon'tFix |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Signature context in recursive groups","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedWon'tFix","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"5.0","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nHello,\n\nI have a problem with signature contexts in mutually\nrecursive groups. I want to write a scanner, which is\nable to read inputs of the form \"int(3)\" or\n\"float(2,0)\" and return corresponding values of the\ndatatype:\n\ndata Token = TInt Int\n\t | TFloat Float\n deriving (Read,Show)\n\nBoth constructors have the same type. Therefore, I want\nto pass them to another function, which reads the\ncorresponding number with the function reads:\n\nscan :: String -> [Token]\nscan ('i':'n':'t':str) = scanNumber TInt str\nscan ('f':'l':'o':'a':'t':str) = scanNumber TInt str\n\nscanNumber :: Read a => (a -> Token) -> String ->\n[Token]\nscanNumber tokenCons ('(':str) = case reads str of\n\t\t ((n,(')':str1)):_) -> tokenCons\n \nn:scan str1\n\t\t _ -> error \"no literal\"\n\nmain = print (scan \"int(4)\")\n\nIn Hugs this program works fine, but ghc does not\naccept it, because of a mutually recursive group. Is\nthis a feature or a bug?\nWhat does the Haskell 98 standard say?\n\nThanks and regards,\n\nFrank Huch\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->nobodynobodyhttps://gitlab.haskell.org/ghc/ghc/-/issues/40a weird kind error with 2-rank types2019-07-07T19:19:54Znobodya weird kind error with 2-rank types```
Type this with ghci -fglasgow-exts:
f :: (forall a b . a b -> int) -> (forall c . c int) ->
int
f x y = x y
The error(?) message is:
"Urk! Inventing strangely-kinded void TyCon ZCc{-a14P-}"
```
<details><summary>Trac metadata...```
Type this with ghci -fglasgow-exts:
f :: (forall a b . a b -> int) -> (forall c . c int) ->
int
f x y = x y
The error(?) message is:
"Urk! Inventing strangely-kinded void TyCon ZCc{-a14P-}"
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 5.02 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedFixed |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"a weird kind error with 2-rank types ","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"5.02","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nType this with ghci -fglasgow-exts:\n\nf :: (forall a b . a b -> int) -> (forall c . c int) ->\nint \nf x y = x y\n\nThe error(?) message is:\n\n\"Urk! Inventing strangely-kinded void TyCon ZCc{-a14P-}\"\n\n\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->nobodynobodyhttps://gitlab.haskell.org/ghc/ghc/-/issues/5830 parameter type classes2019-07-07T19:20:06Ziavor_sd0 parameter type classes```
This seems to be a problem:
Program:
class Tag where
f :: Char
main = main
Output:
ghc -c -fglasgow-exts bug_ghc.hs
bug_ghc.hs:2:
The constraint `Tag' does not mention any of the
universally quantified type variable...```
This seems to be a problem:
Program:
class Tag where
f :: Char
main = main
Output:
ghc -c -fglasgow-exts bug_ghc.hs
bug_ghc.hs:2:
The constraint `Tag' does not mention any of the
universally quantified type variables
in the type `(Tag) => Char'
In the class declaration for `Tag'
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 5.0 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedFixed |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"0 parameter type classes","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"5.0","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nThis seems to be a problem:\n\nProgram:\n\nclass Tag where\n f :: Char\n\nmain = main \n\n\nOutput:\n \nghc -c -fglasgow-exts bug_ghc.hs\n\nbug_ghc.hs:2:\n The constraint `Tag' does not mention any of the \nuniversally quantified type variables\n in the type `(Tag) => Char'\n In the class declaration for `Tag'\n\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->nobodynobodyhttps://gitlab.haskell.org/ghc/ghc/-/issues/565overlapping instances & fundeps broken2019-07-07T19:20:12Zashley-yoverlapping instances & fundeps broken```
Consider this:
--
class X a
instance X Bool
instance (Num a) => X a
--
For as long as "instance Num Bool" is not declared, the two instances do
not de facto overlap. But that's not immediately obvious to GHC, so it will
complain,...```
Consider this:
--
class X a
instance X Bool
instance (Num a) => X a
--
For as long as "instance Num Bool" is not declared, the two instances do
not de facto overlap. But that's not immediately obvious to GHC, so it will
complain, at least by default. But I can stop it complaining by passing
-fallow-overlapping-instances, which I interpret as asking GHC to trust me
that instances don't actually overlap.
But consider this, with an added dependent argument:
--
class X a b | a -> b
instance X Bool Bool
instance (Num a) => X a Char
--
Now GHC will complain even with -fallow-overlapping-instances. I believe
this is inappropriate.
So why have the fundep? Well, GHC can still make use of it, and it can still
calculate the dependent type:
--
class X a b | a -> b where
{
foo :: a -> b;
};
instance X Bool Bool where
{
foo a = a;
};
instance (Num a) => X a Char where
{
foo a = 'N';
}
test = foo True;
--
Without the fundep, GHC cannot calculate 'foo True', since 'instance X Bool
Bool' is not general enough. This is correct. But with the fundep, GHC will
complain that it can't prove that the two instances don't conflict for the
fundep, even with -fallow-overlapping-instances.
I submit that GHC with -fallow-overlapping-instances should not complain
in this case.
```Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/563newtype vs data TC problem2019-07-07T19:20:12Znobodynewtype vs data TC problem```
The following module stops with TC problems, but if
you replace the newtype with data, things work fine.
This problem is in the HEAD, but not in 5.00
Andy
module State2 (StateM, runStateM, genUniqM) where
import ST
newtype Stat...```
The following module stops with TC problems, but if
you replace the newtype with data, things work fine.
This problem is in the HEAD, but not in 5.00
Andy
module State2 (StateM, runStateM, genUniqM) where
import ST
newtype StateM a = StateM (forall s . STRef s Int ->
ST s a)
runStateM :: StateM a -> Int -> (a,Int)
runStateM (StateM fn) u =
runST (do { uRef <- newSTRef u
; res <- fn uRef
; u <- readSTRef uRef
; return (res,u)
})
unStateM :: StateM a -> STRef b Int -> ST b a
unStateM (StateM fn) u = fn u
genUniqM :: StateM Int
genUniqM = StateM (\ uRef -> do { u <- readSTRef uRef
; writeSTRef uRef (u+1)
; return u
})
instance Monad StateM where
return a = StateM (\ uRef -> return a)
m >>= k = StateM (\ uRef -> do { r <- unStateM m
uRef
; unStateM (k r) uRef
})
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 5.0 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedFixed |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"newtype vs data TC problem","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"5.0","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nThe following module stops with TC problems, but if\nyou replace the newtype with data, things work fine.\nThis problem is in the HEAD, but not in 5.00\n\nAndy \n\nmodule State2 (StateM, runStateM, genUniqM) where\n\nimport ST\n\nnewtype StateM a = StateM (forall s . STRef s Int -> \nST s a)\n\nrunStateM :: StateM a -> Int -> (a,Int)\nrunStateM (StateM fn) u = \n runST (do { uRef <- newSTRef u\n ; res <- fn uRef\n ; u <- readSTRef uRef\n\t ; return (res,u)\n })\n\nunStateM :: StateM a -> STRef b Int -> ST b a\nunStateM (StateM fn) u = fn u\n\ngenUniqM :: StateM Int\ngenUniqM = StateM (\\ uRef -> do { u <- readSTRef uRef\n\t\t\t\t; writeSTRef uRef (u+1)\n\t\t\t\t; return u\n\t\t\t\t})\n\ninstance Monad StateM where\n return a = StateM (\\ uRef -> return a)\n m >>= k = StateM (\\ uRef -> do { r <- unStateM m \nuRef\n ; unStateM (k r) uRef\n\t\t\t\t })\n\n\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->nobodynobodyhttps://gitlab.haskell.org/ghc/ghc/-/issues/539Imp. Params not subject to defaulting2019-07-07T19:20:19ZlewieImp. Params not subject to defaulting```
main = putStr $ show $ foo () with ?x = 13
foo () = ?x
Yields:
Ambiguous type variable(s) `a' in the constraint
`Show a'
arising from use of `show' at t2.hs:3
In the first argument of `($)', namely `show'
In the se...```
main = putStr $ show $ foo () with ?x = 13
foo () = ?x
Yields:
Ambiguous type variable(s) `a' in the constraint
`Show a'
arising from use of `show' at t2.hs:3
In the first argument of `($)', namely `show'
In the second argument of `($)', namely `show $
(foo ())'
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 5.0 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedFixed |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Imp. Params not subject to defaulting","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"5.0","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nmain = putStr $ show $ foo () with ?x = 13\n\nfoo () = ?x\n\nYields:\n\n Ambiguous type variable(s) `a' in the constraint\n`Show a'\n arising from use of `show' at t2.hs:3\n In the first argument of `($)', namely `show'\n In the second argument of `($)', namely `show $\n(foo ())'\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/533monotypes w/ IP broken2019-07-07T19:20:20Zlewiemonotypes w/ IP broken```
x () = (?wibble :: Int)
y () = x ()
yields:
Couldn't match `{?wibble :: Int}' against `()'
Expected type: {?wibble :: Int}
Inferred type: ()
In the first argument of `x', namely `()'
in the definition of function `y'...```
x () = (?wibble :: Int)
y () = x ()
yields:
Couldn't match `{?wibble :: Int}' against `()'
Expected type: {?wibble :: Int}
Inferred type: ()
In the first argument of `x', namely `()'
in the definition of function `y': x ()
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | None |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | ResolvedFixed |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"monotypes w/ IP broken","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedFixed","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"None","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nx () = (?wibble :: Int)\n\ny () = x ()\n\nyields:\n\n Couldn't match `{?wibble :: Int}' against `()'\n\tExpected type: {?wibble :: Int}\n\tInferred type: ()\n In the first argument of `x', namely `()'\n in the definition of function `y': x ()\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/531GHC 5.0 fails test tc109.hs2019-07-07T19:20:21ZlewieGHC 5.0 fails test tc109.hs```
Compiler sez:
Illegal instance declaration for `P b'
(There must be at least one non-type-variable in the
instance head)
despite there being ample type-vars in the head ;-)
```
<details><summary>Trac metadata</summary>
| Trac f...```
Compiler sez:
Illegal instance declaration for `P b'
(There must be at least one non-type-variable in the
instance head)
despite there being ample type-vars in the head ;-)
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | None |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedInvalid |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC 5.0 fails test tc109.hs","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"ResolvedInvalid","owner":{"tag":"OwnedBy","contents":"nobody"},"version":"None","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\nCompiler sez:\n\n Illegal instance declaration for `P b'\n\t(There must be at least one non-type-variable in the\ninstance head)\n\ndespite there being ample type-vars in the head ;-)\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->nobodynobody