## monadic Num instance not found in ghci

Here's my code (fun.hs):

```
{-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances #-}
import Control.Monad.Reader
instance Eq (a -> b) where
_ == _ = error "whoops"
instance Show (a -> b) where
show = const "<fun>"
instance (Num a, Monad m, Eq (m a), Show (m a)) => Num (m a) where
fromInteger = return . fromInteger
abs = liftM abs
signum = liftM signum
(+) = liftM2 (+)
(*) = liftM2 (*)
(-) = liftM2 (-)
instance (Fractional a, Monad m, Num (m a)) => Fractional (m a) where
fromRational = return . fromRational
(/) = liftM2 (/)
instance (Floating a, Monad m, Fractional (m a)) => Floating (m a) where
pi = return pi
exp = liftM exp
log = liftM log
sin = liftM sin
cos = liftM cos
tan = liftM tan
sinh = liftM sinh
cosh = liftM cosh
tanh = liftM tanh
asin = liftM sin
acos = liftM cos
atan = liftM tan
asinh = liftM sinh
acosh = liftM cosh
atanh = liftM tanh
```

Test session:

```
$ ghci fun.hs
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( fun.hs, interpreted )
Ok, modules loaded: Main.
*Main> 1 2
<interactive>:1:0:
No instance for (Num (t1 -> t))
arising from the literal `1' at <interactive>:1:0-2
Possible fix: add an instance declaration for (Num (t1 -> t))
In the expression: 1 2
In the definition of `it': it = 1 2
```

Expected result:

```
Loading package mtl-1.0 ... linking ... done.
1
```

This used to work in ghci-6.4. What's also weird is that manually lifting one number seems to help:

```
*Main> (1 + 2) undefined
<interactive>:1:1:
No instance for (Num (a -> t))
arising from the literal `1' at <interactive>:1:1
Possible fix: add an instance declaration for (Num (a -> t))
In the first argument of `(+)', namely `1'
In the expression: (1 + 2) undefined
In the definition of `it': it = (1 + 2) undefined
*Main> (1 + const 2) undefined
3
```

## Trac metadata

Trac field | Value |
---|---|

Version | 6.6 |

Type | Bug |

TypeOfFailure | OtherFailure |

Priority | normal |

Resolution | Unresolved |

Component | GHCi |

Test case | |

Differential revisions | |

BlockedBy | |

Related | |

Blocking | |

CC | |

Operating system | |

Architecture |

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information