[GHC] #10794: Extension request: "where" clauses in type signatures

GHC ghc-devs at haskell.org
Wed Aug 26 12:07:28 UTC 2015


#10794: Extension request: "where" clauses in type signatures
-------------------------------------+-------------------------------------
        Reporter:  danso             |                   Owner:
            Type:  feature request   |                  Status:  new
        Priority:  lowest            |               Milestone:
       Component:  Compiler (Type    |                 Version:  7.10.2
  checker)                           |
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Replying to [comment:4 simonpj]:
 > {{{
 > fold :: (f ~ a -> a -> a)
 >      => f -> [a] -> [a]
 > }}}

 But doing this changes type inference characteristics, by introducing an
 equality and making some type variables untouchable. This was pointed out
 in an earlier bug (sadly, I can't remember any search terms) that
 highlighted a case where the static semantics of using this sort of trick
 was different than the expanded form.

 The place I've wanted a feature like this most is when writing intricate
 type families. But there, it would be necessary to allow local type family
 definitions in the `where` clause.

 All that said, I'm ambivalent about this proposal as stated. It would be
 useful. But does Simon's trick work often enough? Is it worth specifying,
 developing, and maintaining this? I'm not sure.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10794#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list