Hi guys.
The compiler told me to report a bug so that's what I'm doing. I ran the
following command:
ghc-4.04 -o ghcnewperms3 -O2 -fvia-C -O2-for-C -fusagesp Newperms3.hs
(NB it's not patchlevel 1)
from that I got the following:
panic! (the `impossible' happened):
pessimise: missing annot:
PrelIOBase.IO{-3T,i-} PrelBase.Z0T{-40,s-}
Please report it as a compiler bug to [EMAIL PROTECTED]
I hope you can fix this. The haskellfile (Newperms3.hs) is included as an
attachment.
/Josef
module Main(main) where
main = putStr $ shows (filter condition $ permutations p0) "\n"
where
p0 = [0..9] :: [Int]
condition [t,h,i,r,y,w,e,l,v,n] =
expand t h i r t y + 5 * expand t w e l v e ==
expand n i n e t y
expand a b c d e f = f + e*10 + d*100 + c*1000 + b*10000 + a*100000
:: Int
permutations :: [Int] -> [[Int]]
-- build the full permutation list given an ordered list
permutations [] = [[]]
permutations (j:js) = [r | pjs <- permutations js, r <- addj pjs]
where
addj [] = [[j]]
addj (h@(k:ks)) = (j:h): [(k:aks) | aks <- addj ks]