[英]no EmptyL in data.sequence?
I'm currently trying to solve problem 7 on project euler with ideon. 我正在尝试使用ideon解决项目euler上的问题7。 I'm implementing a prime numbers generator. 我正在实现素数生成器。 Here is what I have: 这是我有的:
import Data.Sequence ((|>), empty, viewl, EmptyL, length, index)
isprime primes n = let
factors = viewl primes
inner EmptyL = True
inner (factor :< others) = if n `mod` factor == 0 then False else inner others
in inner primes
nextPrime primes = let
findPrime n = if isPrime primes n then n else findPrime (n + 1)
in primes |> (findPrime $ primes `index` (length primes + 1))
result = head $ foldr (.) id (replicate 1000 nextPrime) [2]
main = putStr $ show result
The problem is, ideone returns me a compilation error: prog.hs:1:42: Module Data.Sequence' does not export
EmptyL' (see https://ideone.com/vlSNX#view_edit_box ). 问题是,ideone返回一个编译错误:prog.hs:1:42:模块Data.Sequence' does not export
EmptyL'(参见https://ideone.com/vlSNX#view_edit_box )。
Have I done something wrong, or is there an issue with ideone? 我做错了什么,或者是否存在ideone的问题?
EmptyL
is a data constructor for the ViewL
type. EmptyL
是ViewL
类型的数据构造函数。 The syntax to import it is: 导入它的语法是:
import Data.Sequence (ViewL (EmptyL, (:<))
or just 要不就
import Data.Sequence (ViewL (..))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.