Automatic inference of an instance using newtype
(A related question Even more generalized new type inference )
I like the wrapper types
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
newtype Foo = Foo { unFoo :: Int } deriving (Eq, Ord, Enum, Real, Num, Read, Integral, Show)
newtype Var = Var { unVar :: Int } deriving (Eq, Ord, Enum, Real, Num, Read, Integral, Show)
to prevent
doSomething :: Int -> Int -> Int
doSomething someFoo otherVar
Is it possible to automatically get all possible instances?
(Not recommended ?, Is there a better way?)
Thank!
+3
source to share
No one has answered this question yet
See similar questions:
or similar: