2016-08-29 1 views
0

this package에 정의 된 Stream 유형을 사용하려고합니다. 나에게이 오류 메시지가 제공Haskell에 설치된 패키지에서 유형 생성자를 가져올 수 없습니다.

import Stream 

tail' :: Stream a -> Stream a 
tail' (Cons x s) = s 

: 음모와 함께 설치 한 후, 나는 빠른 테스트로 스트림에 꼬리 함수를 정의하려고 약간의 검색 후

test.hs:3:14: error: 
    Not in scope: type constructor or class `Stream' 
    Perhaps you meant `StreamT' (imported from Stream) 

test.hs:3:26: error: 
    Not in scope: type constructor or class `Stream' 
    Perhaps you meant `StreamT' (imported from Stream) 

test.hs:4:12: error: Not in scope: data constructor `Cons' 
Failed, modules loaded: none. 

을, 나는 문제가 될 줄 알았는데 모듈을 가져 오면 형식 생성자 Stream과 생성자 Cons이 자동으로 가져 오기되지 않습니다. 그래서 나는

test.hs:1:20: error: Module `Stream' does not export `Stream' 

test.hs:1:28: error: Module `Stream' does not export `Cons' 
Failed, modules loaded: none. 

를 얻을이 수수께끼 된 후

import Stream (Stream, Cons) 

tail' :: Stream a -> Stream a 
tail' (Cons x s) = s 

로 변경되었습니다. 설치된 패키지를 변경하고 StreamCons을 내보내기 목록에 추가해야합니까? 또는 모듈을 올바르게 가져 오지 못했습니까?

+0

링크 한 패키지에만'Data.Stream'이 있습니다. 다른 것을 가져와야합니다. –

답변

1

잘못된 모듈을 가져오고 있습니다. 링크 상단에서 모듈 이름은 Data.Stream입니다. (. Stream는 패키지의 이름입니다 - 이름 설치되는 모듈의 집합) 당신이 주문 import Stream 모두에서 일한다는 사실

import Data.Stream 

tail' :: Stream a -> Stream a 
tail' (Cons x s) = s 

를 작성하는 경우 일이 더 잘 작동한다 그래서 나에게 나타냅니다 당신이 이 모듈을 제공하는 또 다른 패키지가 설치되어 있습니다.

관련 문제