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

infix operators #13

Open
jwaldmann opened this issue Apr 22, 2013 · 4 comments
Open

infix operators #13

jwaldmann opened this issue Apr 22, 2013 · 4 comments

Comments

@jwaldmann
Copy link
Collaborator

the programmer should be able to write (e.g., for the maybe monad)

infixl 1  >>, >>=
m >>= f = case m of ...

the problem seems to be that Template Haskell parses the application of >>=
as http://hackage.haskell.org/packages/archive/template-haskell/2.8.0.0/doc/html/Language-Haskell-TH-Syntax.html#v:UInfixE

@abau abau mentioned this issue Jun 4, 2013
@jwaldmann
Copy link
Collaborator Author

(bumping this issue). I often want $ .
Maybe hard-code $ and >>= in CO4.Prelude?

@abau
Copy link
Owner

abau commented Jan 24, 2015

Maybe hard-code $ and >>= in CO4.Prelude?

Yes, I will look into this.

@abau
Copy link
Owner

abau commented Jan 27, 2015

I just added '$' (see https://github.com/apunktbau/co4/blob/master/test/CO4/Example/HangStandalone.hs#L49)

Should >>= be only defined for Maybe? Maybe there should be two compiler flags MonadMaybe and MonadList that enable return and >>= for Maybe or List respectively? Would that be useful?

Edit: These compiler flags would be mutually exclusive, because they apply to the whole constraint.

@jwaldmann
Copy link
Collaborator Author

$ is fine (it is a simple polymorphic function) , >>= is difficult:

it needs a type class (much work), or a restriction to one fixed instance of that class (a hack).

So I'd say you postpone >>= (like ==).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants