Coder Social home page Coder Social logo

book-real-world-haskell's People

Contributors

hyiltiz avatar jeffreybenjaminbrown avatar wkoszek avatar zarcode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

book-real-world-haskell's Issues

Ch. 18, UglyStack.hs: Newtype deriving statement causes compilation error

Your book is wonderful. Thank you.

In UglyStack.hs, if I comment out the line deriving (Monad, MonadIO, MonadReader AppConfig, MonadState AppState), compilation succeeds. If I don't, I get this error:

UglyStack.hs:59:13: error:
    • No instance for (Applicative MyApp)
        arising from the 'deriving' clause of a data type declaration
      Possible fix:
        use a standalone 'deriving instance' declaration,
          so you can specify the instance context yourself
    • When deriving the instance for (Monad MyApp)
   |
59 |   deriving (Monad, MonadIO, MonadReader AppConfig, MonadState AppState)
   |             ^^^^^

I am using GHC 8.2.1

In later versions of GHCI, MaybeT requires an Applicative instance

Until I added the below Applicative instance, MaybeT.hs would not compile for me in GHCI 8.2.1:

instance Monad m => Applicative (MaybeT m) where
  pure = returnMT
  (<*>) a b = MaybeT $ do
    a' <- runMaybeT a
    case a' of Nothing -> return Nothing
               Just a'' -> do b' <- runMaybeT b
                              case b' of Nothing -> return Nothing
                                         Just b'' -> return $ Just $ a'' b''

Thanks again for Real World Haskell.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.