Skip to content

Instantly share code, notes, and snippets.

View markhibberd's full-sized avatar

markhibberd markhibberd

View GitHub Profile
[repositories]
local
nexus: http://xxx/content/groups/public
nexus-ivy: http://xxx/content/groups/public_ivy, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]
nexus-plugin-ivy: http://xxx/content/groups/public_ivy, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
[boot]
directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/}
Host bastion
User <whatever if required>
IdentityFile <key for bastion host>
HostName <public ip / dns>
Host internal
User <username for internal machine>
IdentityFile <key for internal machine>
ProxyCommand ssh bastion nc <ip for internal machine (as seen by bastion)> 22
> let x :: Int -> IO Int; x n = print n >> pure (1 + n)
> foldr (>=>) pure (replicate 5 x) 0
0
1
2
3
4
5
> foldl (>=>) pure (replicate 5 x) 0
0
import org.apache.log4j.ConsoleAppender
import org.apache.log4j.PatternLayout
import org.apache.log4j.Logger
/* These are global for _all_ tests, this isn't optimal, but hadoop.
Add Debugger.job or Debugger.detailed to your code to get lots
of output. */
object Debugger {
def job(): Unit =
toConsole(Logger.getLogger("org.apache.hadoop.mapred.LocalJobRunner"))
import com.ambiata.ivory.core._
import org.joda.time.DateTimeZone
import org.joda.time.format.DateTimeFormat
import org.joda.time.{DateTime => JodaDateTime}
val d = DateTime(2005,11,6,0)
val localZ = DateTimeZone.forID("America/Swift_Current")
val ivoryZ = DateTimeZone.forID("America/Thunder_Bay")
val s = d.localIso8601
val x = Dates.datetime(s, localZ, ivoryZ).get
Prelude> fix (\f c -> if null c then 0 else 1 + (f (tail c))) [1, 2, 3]
3
Prelude> fix (\f c -> if null c then head c else 1 + (f (tail c))) [1, 2, 3]
*** Exception: Prelude.head: empty list
Prelude> fix (\f c -> if null c then 0 else 1 + (f (tail c))) [1, 2, 3]
3
Prelude> fix (\f c -> if null c then 0 else (head c) + (f (tail c))) [1, 2, 3]
6
Prelude> :t fix
fix :: (t -> t) -> t
[info] Compiling 1 Scala source to /Users/mth/home/art-of-stream-processing-workshop/scalaz-stream/target/scala-2.11/classes...
[error] Illegal index: 0 overlaps List((variable par1,LONG))
[error] locals: Map(1 -> List((variable par1,LONG)))
[error] one error found
[error] (compile:compile) Compilation failed
import Effect.System
data Capture : Effect where
Try : { current ==> {ok} (case ok of
Just n => Vect n String
Nothing => current) } Capture (Maybe Nat)
CAPTURE : Nat -> EFFECT
CAPTURE n = MkEff (Vect n String) Capture

This is a basically what we are running into on https://github.com/argonaut-io/argonaut/tree/series/6.0.x:

[23:22] [        seanparsons  ] With a fresh sbt I get this from 2.9.3: [success] Total time: 78 s, completed 21-Apr-2014 14:20:53
[23:25] [        seanparsons  ] With a fresh sbt I get this from 2.10.4: [success] Total time: 60 s, completed 21-Apr-2014 14:22:57
[23:25] [        seanparsons  ] But in the cross build that second one was: [success] Total time: 332 s, completed 21-Apr-2014 14:01:57

And it seems to be exponential. We are building for 4 platforms (2.9.2, 2.9.3, 2.10.4, 2.11.0). Running ./sbt "; clean ; +test" can take hours.

@markhibberd
markhibberd / Aaa-notes.md
Last active August 29, 2015 13:59
lots of questions

So what I understand to be your questions:

  1. What is a coherency problem?
  2. What does over constained code look like / cause?
  3. How do you lose your "desired" instance?

A way to step through understanding this problem:

  • Oh shit, If I have local type classes, I have to handle crazy wacky cases in my implementation, this will likely have performance and correctness implications (see Coherency.scala)
  • What happens if I close over constraint on construction? Oops if I close over it, I end up with OverConstrained code (see OverConstrainedCode.scala) and worse I still have coherency issues, and the ability to lose my intended behavious (LosingAnInstance.scala)
  • Oh wow, if I just don't do local type classes, by never define conflicting implicits, and ascribe a single type to each behaviour, everything is simple and just works.