import Data.Attoparsec.Text.Lazy
import Data.Text.Lazy.Internal (Text)
import Data.Text.Lazy (pack)
data List a = Nil | Cons a (List a)
list :: Text
list = pack $ unlines
[ "0"
, "1"
, "2"
, "5"
]
How can List Int
parser coud be implemented to parse Cons 0 (Cons 1 (Cons 2 (Cons 5 Nil)))
from list
?
ps: pure parser without parsing a [Int]
and converting it to List Int
is preferable.