[過去ログ] 関数型プログラミング言語Haskell Part32 (1002レス)
前次1-
抽出解除 必死チェッカー(本家) (べ) 自ID レス栞 あぼーん

このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
876
(3): デフォルトの名無しさん [] 2019/12/23(月) 17:59:43.65 ID:/flai8cL(1/5) AAS
もしかしてParsecってあんまり使われてない?
Parsecのドキュメントが2001年とか古いのしか無くて、最初のサンプルコードすら通らない
ライブラリの使い方が解らなくていきなり躓いてる
881: デフォルトの名無しさん [sage] 2019/12/23(月) 21:58:54.38 ID:/flai8cL(2/5) AAS
ここ[parsec: Monadic parser combinators](http://hackage.haskell.org/package/parsec)に載ってる
これ[Parsec, a fast combinator parser](https://web.archive.org/web/20140528151730/http://legacy.cs.uu.nl/daan/download/parsec/parsec.pdf)です
他のは、ついでにParsecに触れているという感じで、詳しそうなのはこれしか見付けられませんでした

<続く>
882: デフォルトの名無しさん [sage] 2019/12/23(月) 21:59:30.49 ID:/flai8cL(3/5) AAS
最初のサンプルコードをGHCiで打ち込んで試そうとしてるんですが、

Prelude> module Main where
Prelude> import Parsec

<no location info>: error:
Could not find module ‘Parsec’
Perhaps you meant Parser (needs flag -package-key ghc-8.6.5)

モジュールが見つからないと言われます
最新バージョンの名前空間?と明らかに違っているので、
ここ[Text.Parsec](http://hackage.haskell.org/package/parsec-3.1.14.0/docs/Text-Parsec.html)で、この二行

import Text.Parsec.Prim
import Text.Parsec.Combinator

を見付け書いたところ

Prelude> import Text.Parsec.Prim
Prelude Text.Parsec.Prim> import Text.Parsec.Combinator

<続く>
883: デフォルトの名無しさん [sage] 2019/12/23(月) 22:00:22.40 ID:/flai8cL(4/5) AAS
Prelude Text.Parsec.Prim Text.Parsec.Combinator> simple :: Parser Char

<interactive>:6:11: error:
Not in scope: type constructor or class ‘Parser’
Perhaps you meant one of these:
‘Parsec’ (imported from Text.Parsec.Prim),
‘ParsecT’ (imported from Text.Parsec.Prim)
Prelude Text.Parsec.Prim Text.Parsec.Combinator> simple :: Parsec Char

<interactive>:7:11: error:
? Expecting two more arguments to ‘Parsec Char’
Expected a type, but ‘Parsec Char’ has kind ‘* -> * -> *’
? In an expression type signature: Parsec Char
In the expression: simple :: Parsec Char
In an equation for ‘it’: it = simple :: Parsec Char
Prelude Text.Parsec.Prim Text.Parsec.Combinator> simple :: ParsecT Char

<interactive>:8:11: error:
? Expecting three more arguments to ‘ParsecT Char’
Expected a type, but
‘ParsecT Char’ has kind
‘* -> (* -> *) -> * -> *’
? In an expression type signature: ParsecT Char
In the expression: simple :: ParsecT Char
In an equation for ‘it’: it = simple :: ParsecT Char

引数が足りないみたいなことを言われます
英語も怪しいのに英語の解説も使えないとなるとどうして良いやら…
885: デフォルトの名無しさん [sage] 2019/12/23(月) 22:05:51.18 ID:/flai8cL(5/5) AAS
>>880
おお、ありがとうございます
そっちでやってみます
前次1-
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.040s