Created
December 24, 2014 23:39
-
-
Save lspitzner/9fcc232aba9c18c8ca7d to your computer and use it in GitHub Desktop.
small example for Writer vs WriterT error message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Monad.Trans.Writer | |
import Data.Monoid ( Sum(..) ) | |
f :: Writer (Sum Int) () | |
f = undefined | |
g :: Writer (Sum Int) Int | |
g = do | |
tell $ Sum 1 | |
f | |
main = return () | |
{- | |
Main.hs:10:3: | |
Couldn't match type ‘()’ with ‘Int’ | |
Expected type: WriterT (Sum Int) Data.Functor.Identity.Identity Int | |
Actual type: Writer (Sum Int) () | |
In a stmt of a 'do' block: f | |
In the expression: | |
do { tell $ Sum 1; | |
f } | |
Failed, modules loaded: none. | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment