summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen/should_compile/T3286b.hs
blob: f6c1fdbeacea3d74fbade070e81827eab9ea1995 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

{-# LANGUAGE GeneralizedNewtypeDeriving #-}

module T3286b (LogFloat) where

newtype LogFloat = LogFloat Double
    deriving (Eq, Ord, Num, Show)

instance Fractional LogFloat where
    (/) (LogFloat x) (LogFloat y)
        |    x == 1
          && y == 1 = error "(/)"
        | otherwise                = LogFloat (x-y)
    fromRational = LogFloat . fromRational