Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When encoding tagged unions as lambdas, the tags are arguments. In this case `Nothing` has two available tags (`nothing` and `just`) and uses the tag `nothing`. `Just` does the same with the tag `just`, only that the tag gets an additional argument (as does its constructor `Just`), such that the value can be extracted afterwards - just like in an enum:

  enum Maybe<T> {
    Nothing,
    Just(T),
  }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: