Sunday, December 27, 2015

Intellij not adding things to the classpath - Exception in thread "main" java.lang.NoSuchMethodError: shapeless.Witness$.mkWitness(Ljava/lang/Object;)Lshapeless/Witness;

Using Intellij? Just added circe (or shapeless, I'm guessing)? Seeing these sorts of exceptions?

Exception in thread "main" java.lang.NoSuchMethodError: shapeless.Witness$.mkWitness(Ljava/lang/Object;)Lshapeless/Witness;
at Example$fresh$macro$73$1.inst$macro$1$lzycompute(PicklingApp.scala:26)
at Example$fresh$macro$73$1.inst$macro$1(PicklingApp.scala:26)
at Example$.delayedEndpoint$Example$1(PicklingApp.scala:26)
at Example$delayedInit$body.apply(PicklingApp.scala:16)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:381)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.App$class.main(App.scala:76)
at Example$.main(PicklingApp.scala:16)
at Example.main(PicklingApp.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at com.intellij.rt.execution.application.AppMain.main(

Just restart Intellij. It's become confused about the classpath.

Wednesday, April 22, 2015

Xamarin Studio 5.9 + F# - Target _CreateNativeLibraryArchive failing

If you're seeing an error like this in Xamarin Studio 5.9, building an Android project:

Target _CreateNativeLibraryArchive:
error : Error executing task CreateNativeLibraryArchive: Argument cannot be
Parameter name: unformatted

You may have mips binary files marked as EmbeddedNativeLibrary.  Turn that off (mips isn't supported yet anyway), and you should be able to build.

The bug has been reported to Xamarin - tech support found the solution.

Saturday, May 17, 2014

Topic from scalaz-stream

I've been playing around with scalaz-stream topics, and didn't understand how they worked. My first attempt was this:

(And note that this was supposed to be just a quick example; you certainly would end up with different threads publishing and subscribing to a topic.)

That had a few problems:

• Line 7-8: the type of out1 is Process[Task, String \/ Int]. Those are useful, but they're only part of the way towards what I needed. What I really wanted was to go from a process to a task to running the task.

• Line 11-13: again, I'm only part of the way there. Both of these produce Task[Unit], and they needed to be run.

So I asked for help on the scalaz mailing list, and Pavel Chlupáček pointed me in the right direction.
The working version is:

• Lines 6-8 produce a Task[IndexedSeq[String \/ Int]], one step further than in the first version (where the steps are process >> task >> run the task).

• Lines 10-12 actually run the task - and anything published before the attemptRun won't be seen by the subscriber.

• Line 19 stalls, waiting for the attemptRun to hook up the subscriber. (As the note says, I think this is only something you'd do for a demo).

• Lines 21-22 actually run the tasks they create