[GHC] #13290: Data constructors should not have RULES

GHC ghc-devs at haskell.org
Fri Feb 17 20:42:34 UTC 2017


#13290: Data constructors should not have RULES
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  dfeuer
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #7398             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by nomeata):

 I’d just like to chime in that from a user point of view, it feels very
 much right and natural that I can define rules that match on constructors,
 and I am honestly surprised that this has not been a supported use-case
 right from the beginning.

 Here is an example:
 {{{#!hs
 data FreeMonad a = Return a | Bind (FreeMonad a) (a -> FreeMonad b)
 {-# RULES "monadLaw1" forall x f . Bind (Return x) f = f x #-}
 }}}
 Looks very benign to me!

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


More information about the ghc-tickets mailing list