Can I use floating point enums in Frege?

59 views Asked by At

I tried

println [1.0, 1.25..2.0] 

but got

Double is not an instance of Enum

I couldn't find this issue in the "differences to Haskell", though. Is there a recommended alternative?

1

There are 1 answers

1
Ingo On BEST ANSWER

You're right that it should be in the "Differences".

For an alternative, consider

iterate :: (a -> a) -> a -> [a]

So, to get your list above, write:

takeWhile (<=2.0) (iterate (+0.25) 1)

It should also be possible to make Double and Float instances of Enum. There is simply lots of work to do in the field of numeric types and type classes.