[Word8]
[Char] ではなく、uu-parsinglib を使用して操作しようとしています。(エラー報告に uu-parsinglib を使用したい。)Word8
それが何であれ、シーケンスの次のものを取得するパーサーが必要です。それができたら、より複雑なパーサーを作成できます。でも、書き方が分からなくて困っています。私が得ることができた最も近いものは次のとおりです。
{-# LANGUAGE FlexibleContexts #-}
module Main where
import Control.Applicative ((<|>))
import Data.Word
import Text.ParserCombinators.UU.BasicInstances
pRawWord8 :: Parser Word8
pRawWord8 = pSatisfy (const True) (Insertion undefined undefined undefined)
ただし、その実装は明らかに間違った型を返します。
amy2.hs:10:13:
Couldn't match type ‘Char’ with ‘Word8’
Expected type: Text.ParserCombinators.UU.Core.P
(Str Char state loc) Word8
Actual type: Text.ParserCombinators.UU.Core.P
(Str Char state loc) Char
In the expression:
pSatisfy (const True) (Insertion undefined undefined undefined)
In an equation for ‘pRawWord8’:
pRawWord8
= pSatisfy (const True) (Insertion undefined undefined undefined)
の型シグネチャがどのように aではなくpSatisfy
a を返すように制限しているのかわからないので、これは私を驚かせます。Char
Word8
どうすれば実装できpRawWord8
ますか?