Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider renaming TraceT #9

Open
jonsterling opened this issue Nov 13, 2014 · 10 comments
Open

Consider renaming TraceT #9

jonsterling opened this issue Nov 13, 2014 · 10 comments

Comments

@jonsterling
Copy link
Contributor

The general pattern is to have a monad signature given in Control.Monad.Sig.Class and then a concrete structure, which is the "canonical" implementation of that signature, in Control.Monad.Trans.SigT.

But TraceT is not the canonical instance of MonadTrace, it is a particular instance which combines tracing with error handling in a useful way. The canonical instance would be a minimal wrapper around StateT, probably.

To avoid confusing people, the TraceT type might be better named something else.

@ghost
Copy link

ghost commented Nov 13, 2014

How about using a free monad? Wouldn't that give you a good notion of canonicity and a simpler structure (referring to #8)?

@jonsterling
Copy link
Contributor Author

Interesting idea! I'm certainly open to it.

@ghost
Copy link

ghost commented Nov 13, 2014

I'll take a shot at it. I see you're already pulling in Codensity :)

@jonsterling
Copy link
Contributor Author

Great! :)

Yeah, I did my best to make it so you can just program against the abstract type, which means that we have a lot of flexibility in improving the internal representation. Thanks!

@ghost
Copy link

ghost commented Nov 13, 2014

How's this? https://gist.github.com/darinmorrison/9f6d757b1cc07865cc41

Didn't do it as a monad transformer yet but that shouldn't be hard. Could use Free instead too.

@jonsterling
Copy link
Contributor Author

This is pretty cool! I haven't used operational or free very much, are there any performance issues I need to worry about?

@ghost
Copy link

ghost commented Nov 13, 2014

Operational's Program should right associate the binds already so you don't need Codensity. This is similar to the Rust thing I'm doing. If you do it CPS style like with Free, you will want to use that though. Actually you don't quite even need Codensity IIRC. Kmett has a "smaller" monad transformer that still works for that but I forget the details just now.

@ghost
Copy link

ghost commented Nov 13, 2014

Also, I would be pretty surprised if the Program version isn't faster than the transformer stack version, even with Codensity or similar tricks.

@jonsterling
Copy link
Contributor Author

Heh, that's neat. Yeah, sounds good!

@ghost
Copy link

ghost commented Nov 14, 2014

Okay. I can add the missing stuff and put together a pull request in a bit.

@ghost ghost mentioned this issue Nov 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant