Function Composition #936
-
In Haskell, we can define function composition using
Is it possible to do the same thing in Dex?
Error Message
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
Yes, it's straightforward to define a
You can't use the
|
Beta Was this translation helpful? Give feedback.
-
Oh, I think that's a bug / limitation of the current type system. At least, I think it's the same as issue #867. I think the problem is that there are multiple possible floating point types, and when you write You can do what you want by telling Dex which kind of number you want:
This is annoying, although it usually isn't an issue when you're not at the top level, so it rarely comes up in practice for me. |
Beta Was this translation helpful? Give feedback.
-
Having defined composition like you did above (I've used
How might we define |
Beta Was this translation helpful? Give feedback.
Oh, I think that's a bug / limitation of the current type system. At least, I think it's the same as issue #867. I think the problem is that there are multiple possible floating point types, and when you write
m = compose sin cos
, the compiler isn't sure which one you want, and can't automatically build anm
that's polymorphic ina
.You can do what you want by telling Dex which kind of number you want:
This is annoying, although it usually isn't an issue when you're not at the top level, so it rarely comes up in practice for me.