Hacker News new | ask | show | jobs
by internet_points 146 days ago
For strings, just add string-conversions to your .cabal and `import Data.String.Conversions` and you can use `cs` to convert between the five, it'll typically figure out from context what type you need. E.g.

    import Data.String.Conversions
    import Data.Text qualified as T
    
    main = do
      url <- readLine
      thing <- fetchFromInterwebs (cs url)
      T.putStrLn (cs thing)
I don't think you need to really understand monad transformers to use them, just know that sometimes you're in "SomethingThatBuildsOnIO" and so you need to liftIO when using IO things.