import Data.Maybe
data Person = Person { name :: String
, idea :: Maybe String } deriving Show
data Plan = Target Person | Dream Plan deriving Show
fischer = Person "Robert Fischer" Nothing
needToGoDeeper :: Person -> Plan
needToGoDeeper = Dream . Dream . Dream . Target
implant :: Plan -> String -> Plan
implant (Target person) idea = Target $ Person (name person) $ Just idea
implant (Dream plan) idea = Dream $ implant plan idea
inception = (needToGoDeeper fischer) `implant` "Let's split the company!"
--afterwards
extract :: Plan -> Person
extract (Dream plan) = extract plan
extract (Target person) = person
data Person = Person { name :: String
, idea :: Maybe String } deriving Show
data Plan = Target Person | Dream Plan deriving Show
fischer = Person "Robert Fischer" Nothing
needToGoDeeper :: Person -> Plan
needToGoDeeper = Dream . Dream . Dream . Target
implant :: Plan -> String -> Plan
implant (Target person) idea = Target $ Person (name person) $ Just idea
implant (Dream plan) idea = Dream $ implant plan idea
inception = (needToGoDeeper fischer) `implant` "Let's split the company!"
--afterwards
extract :: Plan -> Person
extract (Dream plan) = extract plan
extract (Target person) = person