This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Operations are allowed on UnitIntervals that violate the closedness | |
of the structure, but these violations are not realized until the | |
underlying value is determined. | |
*/ | |
final class UnitInterval private (private val underlying: Double) { | |
def - (other: UnitInterval) = | |
new UnitInterval(underlying - other.underlying) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cilib | |
package example | |
import cilib.pso._ | |
import cilib.pso.Defaults._ | |
import cilib.exec._ | |
import eu.timepit.refined.auto._ | |
import scalaz._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am gpampara on github. | |
* I am gpampara (https://keybase.io/gpampara) on keybase. | |
* I have a public key ASAtNa0VALoo2M0QosPJCbti-9sHpkkWSoxfY5EJ9TPflAo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Normal null checking | |
Outer outer = new Outer(); | |
if (outer != null && outer.nested != null && outer.nested.inner != null) { | |
System.out.println(outer.nested.inner.foo); | |
} | |
// Safer | |
def resolve[A](x: A): Option[A] = Option(x) | |
Option(new Outer()).flatMap(x => resolve(x.nested)).flatMap(x => resolve(x.inner)).map(x => System.out.println(x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. After installing GHC, checkout ghc-mod (https://github.com/kazu-yamamoto/ghc-mod) and build master using 7.10.1 | |
2. Update your PATH to include the locaiton of the built 'ghc-mod' and 'ghci-mod' binaries | |
3. Update your emacs config to load up PATH to correctly locate ghc-mod. I needed to add some elisp to my emacs config | |
;; Some shell variable magic | |
(let ((path (shell-command-to-string ". ~/.zshrc; echo -n $PATH"))) | |
(setenv "PATH" path) | |
(setq exec-path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Must be called with two command-line args. | |
# Example: git-svn-relocate.sh http://old.server https://new.server | |
if [ $# -ne 2 ] | |
then | |
echo "Please invoke this script with two command-line arguments (old and new SVN URLs)." | |
exit $E_NO_ARGS | |
fi |