How do I make the power function, doubles and [..] working together in frege? -


while

map (\x -> x * x) [0..9] 

is working fine (also list comprehension), cannot do

map (** 2) [0..9] 

since power operator requires doubles , .. operator not allow them.

is there mapping can use?

the reason double not instance of enum.

there 2 possibilities:

  1. make double instance of enum.
  2. use function converts int values numeric type need:

for example:

(map (** 2) . map fromint) [0..9] 

or, if prefer:

map ((** 2) . fromint) [0..9] 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -