Skip to content

Instantly share code, notes, and snippets.

View banshee's full-sized avatar

James Moore banshee

View GitHub Profile
module FSharpConsumer
let a = FSharpNamespace.Class2.Something;
// Notice that in F# we use "open" for both modules and namespaces.
// See the F# spec section 14.1.3 Opening Modules and Namespace Declaration Groups
// for precise details.
open FSharpNamespace
let b = Class2.Something;
module FSharpModule
let fn() = 1
type Class1() =
member this.X = "F#"
namespace FSharpNamespace
type Class2 =
| Something
| OtherThing of int
using System;
// Note that "using FSharpModule" (without "static") isn't legal C#.
// An FSharp module gets compiled into a type, and "using" specifically
// imports namespaces.
using static FSharpModule;
using FSharpNamespace;
using static FSharpNamespace.Class2;
#pragma warning disable 219 // no warnings about unused variables
@banshee
banshee / gist:afc1d024849ddc1a0807
Last active February 11, 2016 01:41
shapeless experiments
scala> import shapeless._
import shapeless._
scala> import shapeless.ops.function.FnToProduct
import shapeless.ops.function.FnToProduct
scala>
scala> // a normal function taking a string and returning 42
@banshee
banshee / gist:8324977
Last active January 2, 2016 15:39
part of my .gitconfig file
[merge]
summary = true
tool = "p4"
[mergetool "p4"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge \
"$PWD/$BASE" \
"$PWD/$LOCAL" \
"$PWD/$REMOTE" \
"$PWD/$MERGED"
@banshee
banshee / scala ide xml sample
Last active December 31, 2015 21:28
Scala IDE worksheet sample for XML
import scala.xml._
object SampleWorksheet {
// Some simple xml
val xml = """
<cone style="waffle" sprinkles="red">
tasty!!
<scoop size="small" />
<scoop size="large" />
</cone>
@banshee
banshee / gist:7886842
Created December 10, 2013 07:15
Talk for Seattle Scala group
package com.restphone
import scalaz._
import Scalaz._
import scala.concurrent.Future
import scala.concurrent.Future._
import scala.concurrent.Await
import scala.concurrent.duration._
object MonadEvidenceThatWillMakeSenseLater {
type GetList() =
let switchvox_users_voicemail_getList_response = """
</response>"""
le
let switchvox_users_voicemail_getList = """
</request>"""
me
member self.X = switchvox_users_voicemail_getList_response
@banshee
banshee / gist:7775274
Created December 3, 2013 18:53
for fantomas bug report
type GetList() =
let switchvox_users_voicemail_getList_response = """
</response>"""
let switchvox_users_voicemail_getList = """
</request>"""
member self.X = switchvox_users_voicemail_getList_response