I'm trying to compile the following code.
import Data.List
import Data.Ord
import qualified Data.MemoCombinators as Memo
collatzLength :: Int -> Int
collatzLength = Memo.arrayRange (1, 1000000) collatzLength'
where
collatzLength' 1 = 1
collatzLength' n | odd n = 1 + collatzLength (3 * n + 1)
| even n = 1 + collatzLength (n `quot` 2)
main = print $ maximumBy (comparing fst) $ [(collatzLength n, n) | n <- [1..1000000]]
The Haskell compiler spits out:
euler14.o: In function `s1pw_info':
(.text+0x8dd): undefined reference to `__stginit_datazmmemocombinatorszm0zi4zi1_DataziMemoCombinators_'
euler14.o: In function `rfX_info':
(.text+0x35d): undefined reference to `datazmmemocombinatorszm0zi4zi1_DataziMemoCombinators_arrayRange_info'
euler14.o: In function `rfX_srt':
(.data+0x4c): undefined reference to `datazmmemocombinatorszm0zi4zi1_DataziMemoCombinators_arrayRange_closure'
collect2开发者_开发百科: ld returned 1 exit status
I tried googling, but to no avail. Is there anywhere these errors can be looked up? What do they mean?
You gotta compile with the --make flag.
精彩评论