Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 30 2019 14:37
    bhaskarmelkani starred lihaoyi/Ammonite
  • Jan 29 2019 04:27
    JYInMyHeart starred lihaoyi/Ammonite
  • Jan 29 2019 04:27
    JYInMyHeart starred lihaoyi/Ammonite
  • Jan 28 2019 15:07
    ishubelko starred lihaoyi/Ammonite
  • Jan 25 2019 22:38
    borissmidt starred lihaoyi/Ammonite
  • Jan 25 2019 17:12

    alexarchambault on 1.6.3

    (compare)

  • Jan 25 2019 17:11

    alexarchambault on master

    1.6.3 (compare)

  • Jan 25 2019 15:48
    alexarchambault commented #923
  • Jan 25 2019 01:15

    lihaoyi on gh-pages

    5ad9ae5538f23cab92ccd8c6b1617d8… (compare)

  • Jan 25 2019 00:50

    alexarchambault on master

    Partly revert 84d48542 (#923) … (compare)

  • Jan 25 2019 00:50
    alexarchambault closed #923
  • Jan 25 2019 00:50
    alexarchambault closed #920
  • Jan 25 2019 00:50
    alexarchambault closed #922
  • Jan 24 2019 23:13
    lihaoyi commented #923
  • Jan 24 2019 22:39
    alexarchambault closed #921
  • Jan 24 2019 22:39
    alexarchambault commented #921
  • Jan 24 2019 22:39
    alexarchambault edited #923
  • Jan 24 2019 22:38
    alexarchambault opened #923
  • Jan 24 2019 22:37
    david-bouyssie commented #919
  • Jan 24 2019 21:33
    nksureshkumar commented #922
Darren Bishop
@DarrenBishop
Hi all. Has 2.3.8 actually been released yet? The home page suggests it is, but only snapshots (i.e. 2.3.8-58-aa8b2ab1/) seem to be in Central
you're probably on Scala 2.13.4 or newer. It's not released for these versions.
Siddhant Sanyam
@siddhant3s
It it possible to be in Ammonite and re-import a class? Let's say I update the .class file which is on the class path, is it possible to Ammonite to pick up those changes?
import com.foo.bar.StateMachine

val m = StateMachine(42)
val compiled = m.compile()
//////// Make changes to StateMachine.scala in the def compile  and trigger a build loop so that StateMachine.class is updated///
val m = StateMachine(42)
val compiled = m.compile() // <-------- Compiled using new code.
scalway
@scalway
@siddhant3s maybe for such cases --watch will be usefull? https://ammonite.io/#WatchandReload
Or try to import this class again.
Siddhant Sanyam
@siddhant3s
--watch will simply execute my script again and again. I simply want to load it.
Darren Bishop
@DarrenBishop
Thanks Tobias, yes I think that client had bumped to 2.13.5
Miguel Vilá
@miguel-vila

hey, qq, just got a compilation error from a type mismatch which should be the same type but it might appear a different type because they are imported from different modules:

  • main file: import $file.folder.moduleName.type
  • other file (contained in a different folder): import $file.^.folder.moduleName.type
    main has code that invokes other file passing a $file.folder.moduleName.type but expects a $file.^.folder.moduleName.type, which should be the same type.

Shouldn't this compile?

Matthew de Detrich
@mdedetrich
When using --predef to load scripts into ammonite, does anyone know if its possible to access args without the @main method?
For understandable reasons, the @main isn't even executed in a file that is passed into --predef however I want to do some logic in --predef based on command line arguments
Erik Vesterlund
@erikv85
Hi. The scala repl has the :type functionality, while ammonite does not (it would seem). Any chance it will be supported soon?
scala> :h type
display the type of an expression without evaluating it

scala> val x = 1
val x: Int = 1

scala> :type x
Int
Maatary
@Maatary
Hi all,
wondering how do you read an java InputStream with ammonite. The documentation says that it supports it, but i can't seem to make it work
Could someone provide the code snippet for it
There is no direct example of it in the doc, as far as i can tell
Erik Vesterlund
@erikv85

Hi all,
wondering how do you read an java InputStream with ammonite. The documentation says that it supports it, but i can't seem to make it work

Could you be more specific what it is you want to do?

Maatary
@Maatary
read! aFileInputstream
Gernot Ohner
@gernot-ohner
Hi,
This seems like it should be a very frequent question, so I'm sorry if this is a duplicate, but I had a hard time searching for it:
I'm in Ammonite REPL and trying to list the contents of a directory called "abc-def"
ls! pwd/'abc-def
but that doesn't work, because Ammonite thinks thinks the folder name stops at the -
Is there any way to make this work?
Olivier Mélois
@Baccata
@gernot-ohner, ammonite embeds os-lib : https://github.com/com-lihaoyi/os-lib, so you can do os.list(os.pwd / "abc-def")
1 reply
Daniel Sebban
@dsebban_twitter
I am wondering, is there a way to get tab autocompletion for flags in scala-scripts ? zsh gives auto completion for all commands like grep is there a way to get the same behaviour for my .sc ?
Jesse Atkinson
@jsatk
Hello. How do I include cats into ammonite? Everything i see references ivy but I'm on SBT 1.4.7 which uses coursier.
Jesse Atkinson
@jsatk
nevermind. I see that ammoite just works with ivy
@import $ivy.`org.typelevel::cats-core:2.1.1`, cats._, cats.data._, cats.implicits._
import $ivy.$                               , cats._, cats.data._, cats.implicits._
@ val x = List(Some(1))
x: List[Some[Int]] = List(Some(1))
@ x.seq
sequence   sequence_
@ x.sequence
cmd2.sc:1: Could not find an instance of Applicative for G
val res2 = x.sequence
             ^
Compilation Failed
Any idea why I can't sequence here?
Sakib Hadžiavdić
@sake92
@jsatk you need val x: List[Option[Int]] = List(Some(1))
there's no implicits defined for Some, only for Option AFAIK
in cats
Brian Maso
@bmaso
Is there a way to control the Scala version used by Ammonite? I want to use 2.12 for a project I'm on, but the latest release of Ammonite seems to strongly prefer/require 2.13
Li Haoyi
@lihaoyi
download the binary for that scala version, or if you're using Ammonite via ivy then you can choose the version there
Brian Maso
@bmaso
TY -- found this (a little difficult to suss out) on the Ammonite site just now: http://ammonite.io/#OlderScalaVersions
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
Also consider using coursier to launch ammonite (if that's an option):
cs launch ammonite --scala-version 2.13.4
Hans de Jong
@hansdejong
Hi all. In Ammonite.io/embedding it says":
"You can configure the instantiated REPL by passing in arguments to the Main() call, e.g. to redirect the input/output streams or to run a predef to configure it further."
I've no idea what to redirect to what kind of argument. I'm embedding the repl from scala-swing (also in ammonite, embedding works) and I want the IO from and to two TextFields. Are there any suggestions?
Erik Vesterlund
@erikv85
Bump:
.
Sakib Hadžiavdić
@sake92
@erikv85 I think you need os.pwd
eslo
@eslo:hacklab.fi
[m]
Hi! I would like to visualize some of the stuff I did in ammonite. Does anybody have suggestions on what would be the easiest way to get drawings done?
I tried an example with java.awt , but nothing seems to happen. I think I might need to make a window for the drawing somehow.
eslo
@eslo:hacklab.fi
[m]

Ok. I think I want to try processing library for drawing.
For some reason I can't get ammonite to import it though.
import $ivy.org.processing::core:3.3.6
seems to search maven for
.../org/processing/core_2.13/3.3.6/...
instead of the address where things seem to actually exist:
.../org/processing/core/3.3.6/...

Can I get this right somehow?
Or does this just mean my scala version is not supported.

Or do I just have to load it manually?
Apparently this should work with sbt
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
:: adds the scala version prefix, for java libraries you need to use :
sbt will have the same problem if %% was used on this artifact instead of %
eslo
@eslo:hacklab.fi
[m]
Ok great! Now it works! 👍️ I hope my questions aren't too stupid.
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
they aren't :) everyone gets bitten by this at some point (or several times)
eslo
@eslo:hacklab.fi
[m]
I managed to get the processing library drawing some lines in an sbt project, but I can't seem to do that inside ammonite. It just compiles and then does nothing. I can import the defined things to ammonite repls, but they don't do much. I guess I have to figure a way to run this thing.
I think this part is the problem:
object ProcessingTest extends App {
PApplet.main("ProcessingTest")
}
I think sbt just runs that as the main somehow. just setting that as @main didn't seem to help alone
eslo
@eslo:hacklab.fi
[m]
It seems to me right now that the problem might be in that "ProcessingTest" is not actually the name of the class when running inside ammonite for some reason.
eslo
@eslo:hacklab.fi
[m]
I just don't know how to provide it correctly for PApplet.main()