Hi all,
I was trying to do some Elm Voodoo and I stumbled upon a funny thing. It is 
probably deeply wrong, but I want to understand why it is wrong :-)

What I was trying to do was to define a type like this:

type alias Convertor a =
    { convert : b -> a
    }


Here I get "Type alias `Convertor` must declare its use of type variable b"
Now, I understand, why you cannot have 

type alias X a =  { field1: a, field2: b }

But with the source type of functions, things are IMHO different than with 
values. You cannot write values of unbound types and you could not decide 
whether two instances of X are really the same type. 
But you can easily write functions that have unbound source types - like 
this one:

convertString: a -> String 
convertString x =
    (toString x) ++ "_Foo"


And since all of functions with this signature really have the same type at 
JavaScript level, two instances of 'Convertor a' would always had the same 
type.

Now if I had
c: Convertor String
c = {convert = convertString}
the whole thing seems type-safe...

So my question is:
Is this syntax forbidden, because it is an obscure feature that is not 
worth supporting, or would this syntax really allow for some type unsafe 
code?

Thanks!

Martin


-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to