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

How do I run io.println("hello world") from gluon -i? #334

Closed
vi opened this issue Sep 8, 2017 · 4 comments
Closed

How do I run io.println("hello world") from gluon -i? #334

vi opened this issue Sep 8, 2017 · 4 comments

Comments

@vi
Copy link

vi commented Sep 8, 2017

> io.println "hello"
GcPtr(PartialApplicationData { function: Extern(GcPtr(println 0x319e876ab40)), args: ["hello"] })
> :t io.println
String -> IO ()

Where is runIO or something?

@Marwes
Copy link
Member

Marwes commented Sep 8, 2017

That should just work, sorry. The repl is a bit hard to test so occasionally it breaks in ways like that. Will look into it.

Related #51

@brendanzab
Copy link
Member

Shouldn't we have something like :x <expr> to evaluate expressions in IO? Eg.

> :x io.println "hello"
"hello"

Perhaps we could have a helpful error if one doesn't use it.

@brendanzab
Copy link
Member

That's what Idris does at least... it seems in Haskell things 'just work' though:

λ ghci
GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help
Prelude> print "hi"
"hi"
Prelude> :t print
print :: Show a => a -> IO ()
Prelude>

@Marwes
Copy link
Member

Marwes commented Sep 8, 2017

@brendanzab I do like the fact that it just works, maybe it is a bit inconsistent with other monads but there is also nothing else one can actually do with an IO expression than just running it.

The point may become irrelevant with an effect system though

Marwes added a commit to Marwes/gluon that referenced this issue Sep 11, 2017
Broken accidentally when let bindings without a body expression (`let x = 3`) were accepted in the repl

Fixes gluon-lang#334
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

3 participants