I have 2 functions in a plain file with nothing else.
--This is FN1
helper :: Int -> Double -> Double
helper n x = (nu/d)
where
nu = x^n
d = product [1 .. n]
--This is FN2
filterOdd :: [a] -> [a]
filterOdd ls = fi ls [1..]
where
fi [] _ = []
fi (v:vs) (i:ix) = if even i
then v:(fi vs ix)
else fi vs ix
I am using GHC 7.8.3
I know that there is a type error in FN1. I am aware of that. When FN1 is commented and run, GHCi throws no errors. But when FN1 is uncommented and run GHCi show the obvious error in FN1, but also a 2 page long error for FN2.
I don't understand this. There is no explicit relationship between FN1 and FN2. Nothing in FN1 is calling FN2 and vice versa. But why does GHCi show errors for FN2 when FN1 is uncommented?
The exact error is long enough, that I decided to put it on lpaste
Could someone please tell me, what is going on? Mostly likely, I have misunderstood something.
GHC is a state-of-the-art, open source, compiler and interactive environment for the functional language Haskell. Highlights: GHC supports the entire Haskell 2010 language plus a wide variety of extensions. GHC has particularly good support for concurrency and parallelism, including support for Software Transactional Memory (STM).
These are the four types of error handling that are standard and widely used in the Haskell world, as of 2014.
There are detailed instructions for porting GHC to a new platform. GHC has extensive optimisation capabilities, including inter-module optimisation. GHC compiles Haskell code either directly to native code or using LLVM as a back-end.
GHC has extensive optimisation capabilities, including inter-module optimisation. GHC compiles Haskell code either directly to native code or using LLVM as a back-end. GHC can also generate C code as an intermediate target for porting to new platforms.
This was GHC Trac ticket #9323, which gave the example
module Foo where
broken :: [Int]
broken = ()
ambiguous :: a -> String
ambiguous _ = show 0
"thomie" closed the ticket after Simon Peyton Jones left this comment in July:
Everything is fine in HEAD. (I don't know which of the many changes between 7.8 and HEAD is responsible.)
I'll add a regression test. But I don't propose to fix 7.8.
Simon
Note: a peculiar but now-entrenched convention in GHC development circles is to refer to the official git master
branch as HEAD
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With