[GHC] #10055: Offer PolyKinded instances Data.Fixed.HasResolution

GHC ghc-devs at haskell.org
Sun Feb 1 02:09:20 UTC 2015


#10055: Offer PolyKinded instances Data.Fixed.HasResolution
-------------------------------------+-------------------------------------
              Reporter:  redneb      |             Owner:
                  Type:  feature     |            Status:  new
  request                            |         Milestone:
              Priority:  low         |           Version:  7.8.4
             Component:              |  Operating System:  Unknown/Multiple
  libraries/base                     |   Type of failure:  None/Unknown
              Keywords:              |        Blocked By:
          Architecture:              |   Related Tickets:
  Unknown/Multiple                   |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Now that we have `DataKinds` and `PolyKinds`, how about offering an
 instance of `Data.Fixed.HasResolution` for type level natural numbers. For
 example

 {{{#!hs
 instance KnownNat n => HasResolution (n :: Nat) where
     resolution proxy = 10 ^ natVal proxy
 }}}

 or even

 {{{#!hs
 instance KnownNat n => HasResolution (n :: Nat) where
     resolution = natVal
 }}}

 This will make it very easy to create fixed-point types on the fly. The
 following extensions are required for that to work: `DataKinds`,
 `PolyKinds`, `FlexibleInstances`, and `UndecidableInstances`.

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


More information about the ghc-tickets mailing list