Copyright | (c) Donnacha Oisín Kidney 2021 |
---|---|
Maintainer | mail@doisinkidney.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
A probabilistic parser, implemented using the Heap
monad.
The main interesting thing about this parser is that it is defined by
flipping the order of State
and Heap
in the monad stack (the other way
around you get a monad for things like Dijkstra's algorithm,
MonusWeightedSearch.Examples.Dijkstra).
The parser itself is a probabilistic parser, meaning that it can have a preference for certain parse trees over others, based on their likelihood. When the parser is run the output is listed in order of each likelihood.
Documentation
type Parser a = StateT [a] (Heap Prob) Source #
A standard parser type.
Compare to type Parser a b = [a] -> [(b, [a])]
: we have swapped out the
list here for the heap, allowing for efficient ordering of results.