Specifying parametric type is not enforced by the compiler - is this a bug or is expected?

Viewed 94

I've seen this code compile without errors and i can't say if is a bug or if its expected.

type alias Foo = List 
vs 
type alias Foo = List String

and it not just with List. Custom union types are also allowed. Ex:

type State value = Valid value | Invalid value

type alias Model1 =
    { someField : State String } -- i would say this is normal. State is a string..

type alias Model2 =
    { someField : State } -- this doesn't look right.

and also functions are allowed

function1 : List String -> Int
function1 aListOfStrings =
  1

function2 : List -> Int
function2 whatisThisNow =
  1

But if is expected - how to reason about it? I can't wrap my mind around it. Play with it here.

1 Answers
Related