Last active
October 5, 2018 16:38
-
-
Save dcastro/a7f9730981fa404415588224350dc918 to your computer and use it in GitHub Desktop.
Levity-polymorphic Num typeclass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE MagicHash #-} | |
{-# LANGUAGE TypeInType #-} | |
module LevNum where | |
import GHC.Prim | |
import GHC.Exts (TYPE) | |
class LevNum (a :: TYPE r) where | |
levAdd :: a -> a -> a | |
instance LevNum Int where levAdd = (+) | |
instance LevNum Int# where levAdd = (+#) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment