News for hackers. Stuff that matters.

ArminCherusker

Re:Show HN: I built a poker site with Haskell on Friday August 09, 2019 @04:29PM (#20658018)
monad transformers can help alot here:

  getSocketAPIPort :: Int -> IO Int
  getSocketAPIPort defaultPort =
    fromMaybe defaultPort <$> runMaybeT do
      envPort <- MaybeT $ lookupEnv "socketPort"
      MaybeT $ return $ readMaybe envPort