GHC: Ticket Query
http://ghc.haskell.org/trac/ghc/query?status=!closed&reporter=adamgundry&order=priority
The Glasgow Haskell Compileren-USGHChttp://ghc.haskell.org/trac/ghc/chrome/site/ghc_logo.png
http://ghc.haskell.org/trac/ghc/query?status=!closed&reporter=adamgundry&order=priority
Trac 1.0.1
http://ghc.haskell.org/trac/ghc/ticket/8128
http://ghc.haskell.org/trac/ghc/ticket/8128#8128: Standalone deriving fails for GADTs due to inaccessible codeTue, 13 Aug 2013 09:56:20 GMTadamgundry<p>
Consider the following:
</p>
<pre class="wiki">{-# LANGUAGE StandaloneDeriving, GADTs, FlexibleInstances #-}
module StandaloneDerivingGADT where
data T a where
MkT1 :: T Int
MkT2 :: (Bool -> Bool) -> T Bool
deriving instance Show (T Int)
</pre><p>
This gives the error:
</p>
<pre class="wiki">StandaloneDerivingGADT.hs:9:1:
Couldn't match type ‛Int’ with ‛Bool’
Inaccessible code in
a pattern with constructor
MkT2 :: (Bool -> Bool) -> T Bool,
in an equation for ‛showsPrec’
In the pattern: MkT2 b1
In an equation for ‛showsPrec’:
showsPrec a (MkT2 b1)
= showParen
((a >= 11)) ((.) (showString "MkT2 ") (showsPrec 11 b1))
When typechecking the code for ‛showsPrec’
in a standalone derived instance for ‛Show (T Int)’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‛Show (T Int)’
</pre><p>
The derived instance declaration matches on all the constructors, even if they cannot possibly match. It should omit obviously inaccessible constructors so that this example is accepted. For reference, the derived code is:
</p>
<pre class="wiki"> instance GHC.Show.Show
(StandaloneDerivingGADT.T GHC.Types.Int) where
GHC.Show.showsPrec _ StandaloneDerivingGADT.MkT1
= GHC.Show.showString "MkT1"
GHC.Show.showsPrec a_aij (StandaloneDerivingGADT.MkT2 b1_aik)
= GHC.Show.showParen
((a_aij GHC.Classes.>= 11))
((GHC.Base..)
(GHC.Show.showString "MkT2 ") (GHC.Show.showsPrec 11 b1_aik))
GHC.Show.showList = GHC.Show.showList__ (GHC.Show.showsPrec 0)
</pre><p>
The same problem applies to other derivable classes (e.g. <tt>Eq</tt>).
</p>
Resultshttp://ghc.haskell.org/trac/ghc/ticket/8128#changelog
http://ghc.haskell.org/trac/ghc/ticket/9839
http://ghc.haskell.org/trac/ghc/ticket/9839#9839: RTS options parser silently accepts invalid flagsThu, 27 Nov 2014 13:09:34 GMTadamgundry<p>
RTS options that do not take arguments (such as <tt>-T</tt>) silently ignore anything that comes afterwards. For example, <tt>+RTS -T,-s</tt> or <tt>+RTS -T-s</tt> turns on collection of GC statistics (<tt>-T</tt>) but does not print out a summary (<tt>-s</tt>). Instead, this should produce an error message. Otherwise, users may mistakenly think that options have been applied.
</p>
<p>
(This has just bitten us in a production system.)
</p>
Resultshttp://ghc.haskell.org/trac/ghc/ticket/9839#changelog
http://ghc.haskell.org/trac/ghc/ticket/9840
http://ghc.haskell.org/trac/ghc/ticket/9840#9840: Permit empty closed type familiesThu, 27 Nov 2014 14:12:48 GMTadamgundry<p>
At the moment, closed type families without any equations fail with a parse error. In addition, they cannot be created by TH (see <a class="closed ticket" href="http://ghc.haskell.org/trac/ghc/ticket/8028" title="bug: Panic on degenerate closed type family (closed: fixed)">#8028</a>). Would it be possible to permit these instead?
</p>
<p>
My use case is in my typechecker plugin for units of measure, where I want to add new type-level operators without any equational theory (because it will be supplied by the plugin) and without users having the ability to introduce their own type family instances.
</p>
Resultshttp://ghc.haskell.org/trac/ghc/ticket/9840#changelog
http://ghc.haskell.org/trac/ghc/ticket/10094
http://ghc.haskell.org/trac/ghc/ticket/10094#10094: Template Haskell cannot represent type wildcardsMon, 16 Feb 2015 09:53:59 GMTadamgundry<p>
There does not appear to be a way for Template Haskell code to generate partial type signature wildcards. The type quasiquote <tt>[t|_|]</tt> results in <tt>Wildcard not allowed</tt>, and use in an expression quasiquote like <tt>[|() :: _|]</tt> results in <tt>Exotic form of type not (yet) handled by Template Haskell _</tt>.
</p>
<p>
It would be useful if TH code could partially constrain the type of the expressions it was generating, without needing to determine the type completely.
</p>
Resultshttp://ghc.haskell.org/trac/ghc/ticket/10094#changelog
http://ghc.haskell.org/trac/ghc/ticket/8161
http://ghc.haskell.org/trac/ghc/ticket/8161#8161: Associated type parameters that are more specific than the instance headerFri, 23 Aug 2013 12:45:59 GMTadamgundry<p>
It would be nice if type parameters of associated types could be more specific than those in the instance header. This is currently rejected with the message "Type indexes must match class instance head", but could be accepted:
</p>
<pre class="wiki">{-# LANGUAGE TypeFamilies #-}
class C a where
type T a
instance C [a] where
type T [Bool] = Int
type T [Int] = Int
</pre><p>
More typically, this is useful where we want to use an equality constraint to make type inference easier, but need to match on the actual type in an associated type:
</p>
<pre class="wiki">{-# LANGUAGE TypeFamilies, FlexibleInstances #-}
class C a where
type T a
instance a ~ [b] => C a where
type T [b] = Int
</pre><p>
This showed up in the implementation of <a class="wiki" href="http://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/Plan">OverloadedRecordFields</a>. Of course, one can always work around it using a normal (non-associated) type family.
</p>
<p>
Note that we already allow type families to specialise variables that do not occur in the instance header:
</p>
<pre class="wiki">{-# LANGUAGE TypeFamilies #-}
class C a where
type T a b
instance C [a] where
type T [a] [Bool] = Bool
type T [a] [Int] = Int
</pre>Resultshttp://ghc.haskell.org/trac/ghc/ticket/8161#changelog