Closed unclechu closed 2 years ago
@Gabriel439 I have some doubts about the name of the function. Maybe it’s better to explicitly say that it’s about Format
? Like name the function not just makePrinter
but makeFormatPrinter
. What do you think?
@unclechu: Another option would be to just expose the Format
constructor so that people can use (>>-)
directly. There's no real reason that it needs to be hidden
@Gabriel439 Yeah, I would like to just get it exposed in the first place so I wouldn’t have this kind of issue.
I put up a PR to expose the Format
constructor here: https://github.com/Gabriel439/turtle/pull/417
@Gabriel439 I did the same meanwhile https://github.com/Gabriel439/turtle/pull/418 :sweat_smile: Close either one. Anyway, closing this one.
I was trying to implement some abstraction on top of Turtle to redirect the default output (stdout and/or stderr) to a logger function withing some monad where the logger is available. While I was able to implement most of the Turtle function in one way or another it turned out it’s not that trivial to implement custom
printf
andeprintf
since(>>-)
ofTurtle.Format.Format
is not exposed.This change adds
makePrinter
function that just adds extra argument forprintf
that is a printer function ending withm ()
asFormat
result. The implementation is trivial (flip (>>-)
),printf
andeprintf
are reimplemented using this function.