[Haskell-cafe] Problem trying to get class Bounded to work
Bulat Ziganshin
bulat.ziganshin at gmail.com
Tue May 23 02:20:22 EDT 2006
Hello Brian,
Tuesday, May 23, 2006, 4:05:45 AM, you wrote:
> Thanks for the solutions. The GHC scoped typed variables seem to be the best
> solution since they would seem to be the only way to implement something
> where the type only occurs in the result eg (if the actual fonts were to be
> added later):
> createMonoMultiFont
> :: forall i m . (MonadException m, Enum i, Bounded i)
> => m (MonoMultiFont i)
malloc :: Storable a => IO (Ptr a)
malloc = doMalloc undefined
where
doMalloc :: Storable b => b -> IO (Ptr b)
doMalloc dummy = mallocBytes (sizeOf dummy)
these tricks are better if you need to write code that will be
compiled not only by GHC. and i also hope that Haskell' will support
scoping of type variables over the function body
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe
mailing list