Cale Gibbard wrote:
Hello,

There's a prelude function called asTypeOf which might help here:
asTypeOf :: a -> a -> a
asTypeOf = const

You can use maxBound `asTypeOf` (fst3 . head $ elements)

Another option is GHC's scoped type variables, which you use by adding
a type signature to your pattern. See:
http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#scoped-type-variables

Hi Cale -
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)

Thanks,
Brian.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to