Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • 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


  • 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
i can see the implicit in intellij
The cats change is well explained here https://github.com/typelevel/cats/releases/tag/v2.2.0
no need no more to import the 3 amigos, interface, type class instances, and the syntax
Anton Sviridov
your version of cats in the script is 2.0.0 :)
works starting from 2.2.0
@keynmol Not sure to follow
oh gosh
Anton Sviridov
no worries, I had to squint real hard before I saw it.
Ok this is a sign that i need to take a break stop hacking and come back to all of this later. Either way. Thank you so much for the help and guidance. Really made some progress in term of understanding what’s what, and what to expect from Amm itself vs the IDE i am using, how it can integrate and so on. Will def have a look into VS Code
Quick one before i jump into VsCode, is it already matching intellij or it is good enough, if we leave Ammonite issue aside ?
Anton Sviridov

It depends on your definition :) Intellij has improved a lot recently, Metals is a bit more lightweight and more controllable, it matches build definition and compiler output better.

It doesn't have the vast array of IJ's refactorings, but its support for worksheets and ammonite is much better. I don't miss the refactorings because more complex ones constantly break something for me :)

It's certainly good enough - I use it full time on all of the code I write.
Thanks for this !!!
Eitan Adler
I have this code in my application ammonite.Main().run( ) and when I run it I see Compiling (synthetic)/ammonite/predef/ArgsPredef.sc and then it immediately exits
how do I get this to actually drop into a repl?
Artem Egorkine
How can I ask ammonite to use triple quotes to show a string? I'm dealing with json and having no escaped quotes would be much easier
I guess by customizing the PPrint instance somehow?
Eric Swenson
I've asked this question before, but I've never seen any responses to it. I've even asked @lihaoyi directly, but didn't hear from him either. Do any of you know how to pre-compile ammonite scripts such that they don't compile when first run? I'm trying to build a docker container that uses ammonite, but despite my various attempts, each time the container runs, all the scripts get compiled. Has anyone here used ammonite with docker?
Yilin Wei
@eswenson1 Why don't you just create a binary using Graal?
*binary should be image
and just compile the scripts normally
Steve Fosdal
I am interesting in developing additional filters used in AmmoniteFrontEnd. but I would like to have a better understanding of the mechanics. I would like to be able to run amm with remote debugging enabled.
like execute:
JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 && mill -i "amm[2.12.6].run"
and then connect to it via IntelliJ
when I execute it this way, IntelliJ does "seem" to connect, but any debug points I set seem to not be respected.
Has anyone tried this before? or have any suggestions?
Steve Fosdal
no worries. I will continue to dig
Hi, I bumped sbt to 1.4.6 from 1.3.13, now REPL started via sbt projectName/test:run has bad handling of left-arrow / move cursor to left, it visually deletes characters, running amm outside sbt, or downgrading do 1.3.x fixes the issue, ideas?
Eric Swenson


Why don't you just create a binary using Graal? and just compile the scripts normally.

Thanks, but I'm not sure how, and I'm not I want to bite off GraalVM for this. I have working Docker images now, where the scripts are run via ammonite. The only issue is that when the container runs, it recompiles everything every time.

Dmitri Priimak
Hi All. I have my own library that I pull from my local artifact repository. This library has a function that calls upickle.default.read like so
read[Seq[Map[String, String]]](str). When calling this function from inside of ammonite shell I get error
java.lang.NoSuchMethodError: 'boolean upickle.default$.read$default$2()'
Does anyone know what could be the cause of that?
Rajaie Alkorani
I want to import some snapshot jars in my predef. I've added the following repository: interp.repositories() ++= Seq(coursierapi.MavenRepository.of("https://oss.sonatype.org/content/repositories/snapshots"))
If I do the following import in the ammonite predef it fails as if the repository was never added. But if I wait until I'm in the amm shell and do the same import, it works
import $ivy.`org.datasyslab:geospark:1.3.2-SNAPSHOT`

I'm trying to run this ammonite script and it doesn't see an instance of Concurrent for cats.effect.IO:

import coursierapi.MavenRepository

  interp.repositories() ::: List(MavenRepository.of("~/.m2/local"))

import $ivy.`org.typelevel::cats-effect:2.3.1`, cats._, cats.effect.IO._, cats.effect._, cats.syntax.flatMap._, cats.syntax.functor._
import $ivy.`org.codehaus.janino:janino:3.1.2`
import $ivy.`org.jgrapht:jgrapht-core:1.5.0`
import $ivy.`ch.qos.logback:logback-classic:1.2.3`
import $ivy.`io.monix::monix:3.3.0`, monix.eval._, monix.execution.Scheduler.global
import $ivy.`com.typesafe.scala-logging::scala-logging:3.9.2`, com.typesafe.scalalogging._
import $ivy.`org.scalatest::scalatest:3.2.3`
import $ivy.`com.softwaremill.sttp.client3::core:3.0.0`, sttp.client3.SttpBackend
import $ivy.`com.softwaremill.sttp.client3::async-http-client-backend-cats:3.0.0`, sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend
import $ivy.`com.softwaremill.sttp.client3::circe:3.0.0`
import $ivy.`my.custom.local::artifact:1.0.0`, my.custom.local.artifact.alg._, my.custom.local.artifact.graph._, my.custom.local.artifact.input._

import cats.MonadError
import cats.effect.IO._
import cats.effect._
import cats.syntax.flatMap._
import cats.syntax.functor._
import com.typesafe.scalalogging.StrictLogging
import monix.eval._
import monix.execution.Scheduler.global
import my.custom.local.artifact.alg.CycleFinderImpl
import my.custom.local.artifact.flow._
import my.custom.local.artifact.graph.GraphBuilderImpl
import my.custom.local.artifact.input._
import sttp.client3.SttpBackend
import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend

import scala.concurrent.ExecutionContext

import my.custom.local.artifact.MainCatsEffectIOImpl



java.lang.NullPointerException: Cannot invoke "cats.effect.IO.map(scala.Function1)" because "fa" is null

What do I do wrong?

Li Haoyi
no idea, you have a million imports of code that I have never seen in my life lol
Anton Sviridov

@eltherion first thing I'd try is putting your .run into a @main annotated function in the script.

In that main function, put an implicit implicit val cs = IO.contextShift(ExecutionContext.global) and see if things are different

That's the only two things in my experience that don't play nice with Ammonite in particular.

If that fails, I'd recommend minimising your implementation (to demonstrate a problem with CE, if there is one) and providing code in typelevel/cats-effect room.

It smells like somewhere in your code a null is returned instead of IO[A].
@lihaoyi I followed your hints and it's working now, thank you!
Oron Port
why doesn't ammonite load my predef when I directly run a script?
In REPL mode it does
Li Haoyi
predef.scala is for repl, predefScript.scala is for scripts, predefShared.scala is for both
Oron Port
@lihaoyi Thanks! I don't know how I missed that.
Oron Port
@lihaoyi predefShared doesn't seem to work (predefScript.sc works). I tried with .sc and .scala
(I'm on Windows)
Li Haoyi
huh it should, maybe it's a bug
Oron Port
Also, FYI, I opened an ammonite-related issue in Metals scalameta/metals#2413