[GHC] #16155: Pattern Synonym for Ratio

GHC ghc-devs at haskell.org
Wed Jan 9 14:41:12 UTC 2019


#16155: Pattern Synonym for Ratio
-------------------------------------+-------------------------------------
           Reporter:  Zemyla         |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Core           |           Version:  8.6.3
  Libraries                          |
           Keywords:                 |  Operating System:  Unknown/Multiple
  PatternSynonyms, Ratio             |
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 `Data.Ratio` should export a simple pattern synonym that can be used by
 `Safe` code.

 {{{#!hs
 infixl 7 :%:

 pattern n :%: d <- n :% d where
   n :%: d = n % d
 }}}

 It'd be much simpler to use than `numerator` and `denominator`, and
 pattern matching on it would turn into a regular pattern match, hopefully
 for free.

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


More information about the ghc-tickets mailing list