Language extension proposal
Ashley Yakeley
ashley@semantic.org
Fri, 27 Jun 2003 16:24:42 -0700
In article <20030625041751.GA29774@smtp.alicorna.com>,
Andrew J Bromage <ajb@spamcop.net> wrote:
> Another example is floating point format information, like the
> information in C's <float.h>. One might implement this as:
>
> class (Bounded a) => FloatTraits a where
> epsilon :: a -- OK
> mantissaDigits :: Int -- Not OK!
Oh I do this all the time in HBase. I simply do this:
data Type a = MkType
getType :: a -> Type a
getType _ = MkType
class (Bounded a) => FloatTraits a where
epsilon :: a
mantissaDigits :: Type a -> Int
The only annoyance is that you frequently have to write (MkType :: Type
MyFloat). Syntactic sugar for _that_ would be useful.
--
Ashley Yakeley, Seattle WA