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

Syntax for Haskell do? #2

Open
asajeffrey opened this issue Oct 1, 2010 · 1 comment
Open

Syntax for Haskell do? #2

asajeffrey opened this issue Oct 1, 2010 · 1 comment

Comments

@asajeffrey
Copy link
Member

Can we use Agda 2.2.8's syntax mechanism to define a binder similar to Haskell's do?

@treep
Copy link

treep commented Sep 30, 2011

One can write something like this:

module IOTest where

open import System.IO

infixl 1 _<_
infixr 1 bind
infixr 2 _!_

_<_  = _>>_
_!_  = _>>_
bind = _>>=_
do   = skip

syntax bind e₁ (λ x  e₂) = x  e₁ , e₂

main = do
  < s  getStr
  , putStr "Hi, "
  ! putStr s
  ! putStr "!\n"
  < m  getStr
  , putStr m

it's similar, but unfortunately includes all these random characters.

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

2 participants