language: Haskell (ghc-7.4.1)
date: 917 days 18 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import Control.Monad
 
data MyType a = MyType a
 
instance Monad MyType where
   return f = undefined
   f >>= g = undefined
 
instance MonadPlus MyType where
   mzero = MyType (0 :: Int)
   mplus = undefined
 
main = do
  let foo = mzero :: MyType Int
  print 4
[1 of 1] Compiling Main             ( prog.hs, prog.o )

prog.hs:10:19:
    Couldn't match expected type `a' against inferred type `Int'
      `a' is a rigid type variable bound by
          the type signature for `mzero' at <no location info>
    In the first argument of `MyType', namely `(0 :: Int)'
    In the expression: MyType (0 :: Int)
    In the definition of `mzero': mzero = MyType (0 :: Int)