Skip to content
Brian Marick edited this page May 10, 2017 · 3 revisions

Solution you can compile

Problem 1

untag : Tagged tag value -> value
untag (Tagged value) = value

Problem 2

map : (oldValue -> newValue) -> Tagged tag oldValue -> Tagged tag newValue
map f (Tagged value) = 
  Tagged <| f value

Problem 3

map2 : (a -> b -> c) -> Tagged tag a -> Tagged tag b -> Tagged tag c
map2 f (Tagged one) (Tagged two) =
  Tagged <| f one two

With three values, I thought a -> b -> c was as descriptive as longer identifiers and easier to skim.