Skip to content

Instantly share code, notes, and snippets.

@mjul
Created October 18, 2016 07:43
Show Gist options
  • Save mjul/8abddaf13cd6643a7df10152cc34c2e6 to your computer and use it in GitHub Desktop.
Save mjul/8abddaf13cd6643a7df10152cc34c2e6 to your computer and use it in GitHub Desktop.
F# interactive exposes a bug in Mono (OSX)
fsibug $ cat mini.fsx
type A = A of int
let result = [for a in 1..3 -> A a]
printfn "Succeeded: %A" result
fsibug $ fsharpi mini.fsx
System.TypeLoadException: Failure has occurred while loading a type.
at [email protected] (System.Collections.Generic.IEnumerable`1[FSI_0001+A]& next) [0x000a0] in <096c3b14bd5948a9921b6ca3f280fec3>:0
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T].MoveNextImpl () [0x00017] in <57dfe31ddff9fae1a74503831de3df57>:0
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T].System-Collections-IEnumerator-MoveNext () [0x00001] in <57dfe31ddff9fae1a74503831de3df57>:0
at Microsoft.FSharp.Collections.SeqModule.ToList[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x0003f] in <57dfe31ddff9fae1a74503831de3df57>:0
at <StartupCode$FSI_0001>.$FSI_0001.main@ () [0x00012] in <096c3b14bd5948a9921b6ca3f280fec3>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in <94fd79a3b7144c54b4cb162b50fc7761>:0
Stopped due to error
fsibug $ fsharpc mini.fsx
F# Compiler for F# 4.1
Freely distributed under the Apache 2.0 Open Source License
fsibug $ mono mini.exe
Succeeded: [A 1; A 2; A 3]
type A = A of int
let result = [for a in 1..3 -> A a]
printfn "Succeeded: %A" result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment