2013-09-25 4 views
2

내가 브라이언 설리번의 Attoparsec 기반의 HTTP 파서 (http://www.serpentine.com/blog/2010/03/03/whats-in-a-parser-attoparsec-rewired-2/)에 대한 테스트를 실행하려고 발견, 나는이 오류가 없어 :Attoparsec`many` 방법은

> runhaskell TestRFC2616.hs 

TestRFC2616.hs:13:30: 
    Not in scope: `many' 
    Perhaps you meant one of these: 
     `any' (imported from Prelude), 
     `B.any' (imported from Data.ByteString.Char8), 
     many' (imported from Data.Attoparsec) 

놀을, 나는 ghci를 실행하고이 있어요 :

> ghci 
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help 
Loading package ghc-prim ... linking ... done. 
Loading package integer-gmp ... linking ... done. 
Loading package base ... linking ... done. 
Prelude> :m +Data.Attoparsec 
Prelude Data.Attoparsec> :t many 

<interactive>:1:1: 
    Not in scope: `many' 
    Perhaps you meant one of these: 
     `any' (imported from Prelude), 
     many' (imported from Data.Attoparsec), 
     `many1' (imported from Data.Attoparsec) 
Prelude Data.Attoparsec> 

아무도 나에게 무슨 일이 일어 났는지 말해 줄 수 있습니까?

+5

'many''가 아니라'many'를 제안하는 것이 좋습니다. 그리고 아마 당신은'Control.Applicative'의'many'를 원할 것입니다. –

답변

1

이 예제는 4 살입니다. 버전 0.8.0에서는 Data.Attoparsec.Combinator 모듈에 many을 구현 했으므로 here 소스를 확인할 수 있습니다.

라이브러리의 현재 버전은 many 함수를 구현하지 않지만 many' 함수 (소스 here)를 구현합니다. 그래서 ghcimany'을 제안합니다. Data.Attoparsec.Combinator 구현 하였다

many은 (hereAlternative 형 클래스 many의 이행을 참조) Control.Applicative에서 구현되는 것과 같은 것이다. Control.Applicative 일 경우 import이 필요합니다. 그게 효과가 있다면 그 문제를 풀기위한 요청 (도서관 저장소는 here 임)