
In the following paper we introduced an implementation that performs lookup
in O(log n) and insertion in O(1) by moving some of the work to compile
time.
@INPROCEEDINGS { MVP13,
AUTHOR = { Martinez, Bruno and Viera, Marcos and Pardo, Alberto },
TITLE = { Just Do It While Compiling!: Fast Extensible Records in
Haskell },
BOOKTITLE = { Proceedings of the ACM SIGPLAN 2013 Workshop on Partial
Evaluation and Program Manipulation },
SERIES = { PEPM '13 },
YEAR = { 2013 },
ISBN = { 978-1-4503-1842-6 },
LOCATION = { Rome, Italy },
PAGES = { 77--86 },
NUMPAGES = { 10 },
DOI = { 10.1145/2426890.2426908 },
ACMID = { 2426908 },
PUBLISHER = { ACM },
ADDRESS = { New York, NY, USA },
KEYWORDS = { balanced trees, extensible records, haskell, hlist, staged
computation, type-level programming },
PDF = { http://www.fing.edu.uy/~mviera/papers/pepm13.pdf },
}
Best,
marcos
On Tue, May 5, 2015 at 6:50 AM, Roman Cheplyaka
On 05/05/15 12:40, Alberto G. Corona wrote:
Hi,
Anyone used some of the extensible record packages to create a kind of extensible state monad?
I mean something that besides having "get", "gets" and "put" would have some kind of "add" and "gets":
add :: a -> State () gets :: State (Maybe a)
or
add :: LabelName -> a -> State () gets :: LabelName -> State (Maybe a)
So that I can extend the state without using additional monad transformers. Monad transformers are very hard for beginners and scramble error messages
I did the first option for MFlow, hplayground and Transient packages (setSData and getSData). But my solution uses a map indexed by type and this requires a lookup for each access.
I would like to know if there is an alternative with no lookups. I´m not obsessed with speed but In some applications the speed may be important....
Anyone?
If you care about the error message quality, you'd rather stay away from extensible records.
And if you care about speed, most (all?) extensible records give you O(n) access, so you'd be actually better off with a simple (Hash)Map.
Roman
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe