[Haskell-cafe] How do you make constant expressions?

Max Bolingbroke batterseapower at hotmail.com
Mon Jul 19 04:42:35 EDT 2010


Use NoMonomorphismRestriction or give an explicit type signature:

width :: Num a => a
width = 800

Max

On 19 July 2010 09:17, Eitan Goldshtrom <thesourceofx at gmail.com> wrote:
> Correction to my last e-mail. I figured out why it worked at first and then
> failed, so I'll refine my question. I'd like the compiler to simply put the
> number 800 everywhere that I put the name "width" in my code. Instead it's
> putting (800 :: Float), or Double or Int, whatever I want, but it's
> restricted to one data type. I want to remove that restriction since it is a
> constant.
>
> -Eitan
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>


More information about the Haskell-Cafe mailing list