PolyKind for Fixed and HasResolution from Data.Fixed

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

PolyKind for Fixed and HasResolution from Data.Fixed

Никита Тимофеев
Hi all!

If we define HasResolution and Fixed like that:

class HasResolution (a :: k) where
    resolution :: p a -> Integer

newtype Fixed (a :: k) = Fixed Integer

We can do something like that:

instance KnownNat a => HasResolution a where
    resolution = natVal

2.3 :: Fixed 1

--
Timofeev N.D.

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe