New paste Repaste Download
data Area = Field | Cliff | River | Path
data Abilities = Flight | Swim | Run | Climb | Harvest
areaOfDirection :: String -> String
areaOfDirection x =
  case x of
    "field" -> "welcome to the rice fields, motha... you get what i mean, "
    "cliff" -> "too steep for me, have a cliff bar and a redbull, "
    "river" -> "can you hear the sound of the river? i love it here. lets fish some fish, "
    "path" -> "I see you're not taking the well-worn path. An individual of culture you're, "
    _ -> "CHOOSE, "
abilitiesBySurroundings :: String -> Abilities
abilitiesBySurroundings x =
  case x of
    "flight" -> Flight
    "swim" -> Swim
    "run" -> Run
    "climb" -> Climb
    "harvest" -> Harvest
stateYourAbility :: Abilities -> String
stateYourAbility x =
  case x of
    Flight -> "I knew that redbull will come in handy!"
    Swim -> ""
leftRightForward :: String -> String
leftRightForward movement =
  case movement of
    "left" -> "you're going left, "
    "right" -> "you're going right, "
    "forward" -> "you're going forward, "
    _ -> "type where you wanna go, "
main :: IO ()
main = do
  putStrLn "please enter your name"
  name <- getLine
  putStrLn "type where you wanna go. left, right, or forward"
  direction <- getLine
  putStrLn $ leftRightForward direction ++ name ++ "."
  putStrLn "now. where do you wanna go? field, cliff, river or path?"
  area <- getLine
  putStrLn $ areaOfDirection area ++ name ++ "!"
  putStrLn "now. Choose an ability"
  ability <- getLine
  putStrLn $ abilitiesBySurroundings ability
Filename: higherOrderFunctions.hs. Size: 2kb. View raw, , hex, or download this file.

This paste expires on 2025-02-07 02:59:19.129529. Pasted through v1-api.