According to What does comparable mean in Elm? comparable
is built-in type constraint that can be used to limit type variables to those built-in types that are, well, comparable. The following questions comes to mind (and are not so easy to find out):
- what are the other type constraints that currently exists in Elm? Is there a list somewhere?
- Is there a way how I can create my own type constraints? I presume that the answer is no, since Elm does not have any mechanism such as Haskell Typeclasses right now?
- If the above is true (no custom type constraints), that does mean that the polymorphism is quite limited in Elm, doesn't it? For example, it seems that the following is not achievable right now: I want to create a function
f
that accepts List of elements (of a same but uncertain type) each of which can be used as an argument to some functiong
(i.e.f
acceptsList a
and moreoverinst
being of typea
implies thatg(inst)
makes sense)
comparable
, so I wasn't sure, what's the status of this in Elm. – Tomas Kulich