Skip to content

Instantly share code, notes, and snippets.

@dewey92
Created May 2, 2019 17:33
Show Gist options
  • Select an option

  • Save dewey92/014d4d0cd4fe1990e84ce1ca1fec19f0 to your computer and use it in GitHub Desktop.

Select an option

Save dewey92/014d4d0cd4fe1990e84ce1ca1fec19f0 to your computer and use it in GitHub Desktop.
Basic Haskell ADT
-- Boolean teridiri dari dua buah value: True dan False
data Bool = True | False
-- List (atau Array) bisa diekspresikan dengan 2 buah data: Nil dan Cons.
-- @example
-- ["Jihad", "Waspada"] == Cons "Jihad" (Cons "Waspada" Nil)
data List a = Nil | Cons a (List a)
-- Beberapa Functor..
data Maybe = Just a | Nothing
data Either a b = Left a | Right b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment