Skip to content

Instantly share code, notes, and snippets.

open System
type Cylinder =
| FourFourEight
| SixSixTwelve
| ThreeThreeSix
| TwoTwoTwo
type CylinderMeasurement =
{ WidthA: float
open FsCheck
type Tree<'a> =
| Branch of 'a * Tree<'a> * Tree<'a>
| Empty
let associativity (x: Tree<int>, F(_, f: Tree<int> -> float), F(_, g: float -> char), F(_, h: char -> int)) =
((f >> g) >> h) x = (f >> (g >> h)) x + 1 // let it fail
Check.Quick associativity
Install ID: bae38b44-cee7-4166-9ca6-ee73bde2b9d0
16.02.2014 22:47:11 [Info] Server started at ws://localhost:8089
Web server started at http://localhost:8090/
Running the CloudSharper service. Press Enter to stop
Server exited with code 0.
'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Platform.AppDomainManager\v4.0_11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Platform.AppDomainManager.dll'
'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'
'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'
'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'
**[Incremental builder cache] Creation. BuildCacheSize = 50.** Stack trace: at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at Microsoft.FSharp.Compiler.SourceCodeServices.BackgroundCompiler..ctor()
at Microsoft.FSharp.Compiler.SourceCodeServices.InteractiveChecker..ctor()
at <StartupCode$FSharp-Compiler-Service>.$Service..cctor()
at Microsoft.FSharp.Compiler.SourceCodeServices.InteractiveChecker..cctor()
at Microsoft.FSharp.Compiler.SourceCodeServices.InteractiveChecker.Create()
at FSharp.CompilerBinding.LanguageService..ctor(FSharpFunc`2 dirtyNotify) in L:\git\FSharpVSPowerTools\src\FSharpVSPowerTools.Core\LanguageService.fs:line 119
at FSharpVSPowerTools.ProjectSystem.VSLanguageService..ctor(IServiceProvider serviceProvider, IVsEditorAdaptersFactoryService editorFactory, FSharpLanguageService fsharpLanguageService) in L:\git\FSharpVSPowerTools\src\FSharpVSPowerTools.Logic\VSLanguageService.fs:line 21
at System.Runti
let q = Expr.Coerce (<@@ obj() @@>, typeof<string>)
// val q : Expr = Coerce (NewObject (Object), String)
let q' = <@@ obj() :?> string @@>
// val q' : Expr = Call (None, UnboxGeneric, [NewObject (Object)])
// before
entity.BaseType
|> Option.bind (fun bt ->
if bt.HasTypeDefinition then Some bt.TypeDefinition
else None)
// after
match entity.BaseType with
| Some (TypeWithDefinition def) -> Some def
| _ -> None
module Events =
type IEvent =
abstract Id: Guid
type Event<'a> =
{ Id: Guid
Payload: 'a }
interface IEvent with
member x.Id: Guid = x.Id
object StructuralTypes {
def time[A](f: => A) = {
val t0 = System.nanoTime
val ans = f
printf("Elapsed: %.3f sec\n", (System.nanoTime - t0) * 1e-9)
ans
}
class My(value: Int){
def getId = value
import scala.concurrent.stm._
object Test {
def run(n: Int) = {
val x = Ref(0)
val y = Ref(0)
(1 to n) foreach { i =>
atomic { implicit tx =>
val x1 = x()