Skip to content

Instantly share code, notes, and snippets.

@exterm
Last active December 13, 2015 21:38
Show Gist options
  • Select an option

  • Save exterm/4978792 to your computer and use it in GitHub Desktop.

Select an option

Save exterm/4978792 to your computer and use it in GitHub Desktop.
Type System restrictions: Haskell forces constructors to be unambigous, erlang (dialyzer) doesn't care.
data T1 = Bernd | Uwe
data T2 = Bernd | Flo
1_types.hs:2:11:
Multiple declarations of `Bernd'
Declared at: 1_types.hs:1:11
1_types.hs:2:11
-type t1() :: bernd | uwe
-type t2() :: bernd | flo
%% dialyzer accepts this without complaining and constructing contracts with these types works.
%% bernd, uwe and flo are atoms, not constructors - but they're used for the same purpose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment