Skip to content

Instantly share code, notes, and snippets.

@b0oh
Last active December 15, 2015 19:29
Show Gist options
  • Select an option

  • Save b0oh/5311394 to your computer and use it in GitHub Desktop.

Select an option

Save b0oh/5311394 to your computer and use it in GitHub Desktop.
module Fantom where
data NoPower
data Power
data Product = Donut | Bread deriving Show
data Oven product power = Oven product
oven :: Product -> Oven Product NoPower
oven product = Oven product
addPower :: Oven Product NoPower -> Oven Product Power
addPower (Oven pr) = Oven pr
makeProduct :: Oven Product Power -> Product
makeProduct (Oven pr) = pr
main = print . show $ makeProduct $ addPower $ oven Donut
-- => "Donut"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment