I have one specific file which is reason of throwing such error:
Resolving startup promise because FSAC printed the 'listener started' message
[I] 2017-02-10T14:19:15.3806710Z: listener started in 52.252 ms with binding 127.0.0.1:8137 [Suave.Tcp.tcpIpServer]
Stack overflow in unmanaged: IP: 0x9f90ccd4, fault addr: 0xb079dff8
Stack overflow in unmanaged: IP: 0x1ba7ec, fault addr: 0xb089f8bc
Stack overflow in unmanaged: IP: 0x1ba7ec, fault addr: 0xb0ecd89c
Unhandled Exception:
StackOverflowException
[ERROR] FATAL UNHANDLED EXCEPTION: System.StackOverflowException: The requested operation caused a stack overflow.
at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_marshal_isinst_with_cache (object,intptr,intptr)
at (wrapper castclass) System.Object:__isinst_with_cache (object,intptr,intptr)
at Microsoft.FSharp.Collections.SeqModule.ToList[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x00016] in <5584aad2904cf4daa7450383d2aa8455>:0
at Microsoft.FSharp.Compiler.SourceCodeServices.Parser.ReportError (Microsoft.FSharp.Compiler.CompileOps+TcConfig tcConfig, System.Boolean allErrors, System.String mainInputFileName, System.Tuple`2[T1,T2] fileInfo, System.Tuple`2[T1,T2] _arg1) [0x0001f] in <58823331ddab8ea7a745038331338258>:0
at Microsoft.FSharp.Compiler.SourceCodeServices.Parser.report@1451-2 (Microsoft.FSharp.Compiler.SourceCodeServices.Parser+ErrorHandler this, Microsoft.FSharp.Compiler.FSharpErrorSeverity sev, Microsoft.FSharp.Compiler.ErrorLogger+PhasedError exn) [0x0001d] in <58823331ddab8ea7a745038331338258>:0
at Microsoft.FSharp.Compiler.SourceCodeServices.Parser+ErrorHandler.errorSink (Microsoft.FSharp.Compiler.FSharpErrorSeverity sev, Microsoft.FSharp.Compiler.ErrorLogger+PhasedError exn) [0x0004c] in <58823331ddab8ea7a745038331338258>:0
at Microsoft.FSharp.Compiler.SourceCodeServices.Parser+-ctor@1468-101.ErrorSinkImpl (Microsoft.FSharp.Compiler.ErrorLogger+PhasedError ) [0x0000c] in <58823331ddab8ea7a745038331338258>:0
at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ErrorLogger.ErrorR (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger x, System.Exception exn) [0x00025] in <58823331ddab8ea7a745038331338258>:0
at Microsoft.FSharp.Compiler.SourceCodeServices.Parser+parseResult@1518.Invoke (Internal.Utilities.Text.Lexing.LexBuffer`1[Char] lexbuf) [0x00122] in <58823331ddab8ea7a745038331338258>:0
at Microsoft.FSharp.Compiler.Lexhelp+usingLexbufForParsing@88[a].Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x00001] in <58823331ddab8ea7a745038331338258>:0
at Microsoft.FSharp.Compiler.Lexhelp.reusingLexbufForParsing[a] (Internal.Utilities.Text.Lexing.LexBuffer`1[Char] lexbuf, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] f) [0x00027] in <58823331ddab8ea7a745038331338258>:0
at Microsoft.FSharp.Compiler.Lexhelp.usingLexbufForParsing[a] (Internal.Utilities.Text.Lexing.LexBuffer`1[Char] lexbuf, System.String filename, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] f) [0x0001b] in <58823331ddab8ea7a745038331338258>:0
at Microsoft.FSharp.Compiler.SourceCodeServices.Parser.ParseOneFile (System.String source, System.Boolean matchBracesOnly, System.Boolean reportErrors, System.String mainInputFileName, Microsoft.FSharp.Collections.FSharpList`1[T] projectSourceFiles, Microsoft.FSharp.Compiler.CompileOps+TcConfig tcConfig) [0x00096] in <58823331ddab8ea7a745038331338258>:0
at <StartupCode$FSharp-Compiler-Service>.$Service+ParseAndCheckFileInProject@2506.Invoke (System.Threading.CancellationToken _ct) [0x000bf] in <58823331ddab8ea7a745038331338258>:0
at <StartupCode$FSharp-Compiler-Service>.$Reactor+EnqueueAndAwaitOpAsync@139-2[T].Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x00008] in <58823331ddab8ea7a745038331338258>:0
at <StartupCode$FSharp-Compiler-Service>.$Reactor+loop@62-91.Invoke (Microsoft.FSharp.Core.FSharpOption`1[T] _arg2) [0x002ba] in <58823331ddab8ea7a745038331338258>:0
at Microsoft.FSharp.Control.AsyncBuilderImpl+args@835-1[a,b].Invoke (a a) [0x00016] in <5584aad2904cf4daa7450383d2aa8455>:0
at Microsoft.FSharp.Control.AsyncBuilderImpl+resultA@817[a].Invoke (Microsoft.FSharp.Control.AsyncParams`1[T] _arg1) [0x00066] in <5584aad2904cf4daa7450383d2aa8455>:0
at Microsoft.FSharp.Control.AsyncBuilderImpl+args@835-1[a,b].Invoke (a a) [0x000a8] in <5584aad2904cf4daa7450383d2aa8455>:0
at Microsoft.FSharp.Control.AsyncBuilderImpl+resultA@817[a].Invoke (Microsoft.FSharp.Control.AsyncParams`1[T] _arg1) [0x00066] in <5584aad2904cf4daa7450383d2aa8455>:0
at Microsoft.FSharp.Control.AsyncBuilderImpl+callA@851[b,a].Invoke (Microsoft.FSharp.Control.AsyncParams`1[T] args) [0x0012e] in <5584aad2904cf4daa7450383d2aa8455>:0
at Microsoft.FSharp.Control.AsyncBuilderImpl+args@835-1[a,b].Invoke (a a) [0x000a8] in <5584aad2904cf4daa7450383d2aa8455>:0
at <StartupCode$FSharp-Core>.$Control+Post@2338.Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x00001] in <5584aad2904cf4daa7450383d2aa8455>:0
at <StartupCode$FSharp-Core>.$Control.loop@430-52 (Microsoft.FSharp.Control.Trampoline this, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] action) [0x00001] in <5584aad2904cf4daa7450383d2aa8455>:0
at Microsoft.FSharp.Control.Trampoline.ExecuteAction (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] firstAction) [0x00018] in <5584aad2904cf4daa7450383d2aa8455>:0
at Microsoft.FSharp.Control.TrampolineHolder.Protect (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] firstAction) [0x00032] in <5584aad2904cf4daa7450383d2aa8455>:0
at <StartupCode$FSharp-Core>.$Control+-ctor@516-1.Invoke (System.Object state) [0x00018] in <5584aad2904cf4daa7450383d2aa8455>:0
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x0000e] in <12e050e5b3d34326a1b4e2e7624e75da>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x0008d] in <12e050e5b3d34326a1b4e2e7624e75da>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <12e050e5b3d34326a1b4e2e7624e75da>:0
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x0002a] in <12e050e5b3d34326a1b4e2e7624e75da>:0
at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00096] in <12e050e5b3d34326a1b4e2e7624e75da>:0
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <12e050e5b3d34326a1b4e2e7624e75da>:0
the source code responsible for such error is:
module Examples
// let squareAndAdd (a:float) (b:float) : int = int (a * a + b);;
// // let round x =
// // if x >= 100 then 100
// // elif x < 0 then 0
// // else x
// let round x =
// match x with
// | _ when x >= 100 -> 100
// | _ when x < 0 -> 0
// | _ -> x
// let round2 (x, y) =
// if x >= 100 || y >= 100 then 100, 100
// elif x < 0 || y < 0 then 0, 0
// else x, y
// let rec factorial n = if n <= 1 then 1 else n * factorial (n - 1)
// let rec lenght l =
// match l with
// | [] -> 0
// | h :: t -> 1 + lenght t
// let rec repeatFetch url n =
// if n > 0 then
// let html = http url
// printfn "fetched <<< %s >>> on iteration %d" html n
// repeatFetch url (n - 1)
// let rec badFactorial n = if n <= 1 then 1 else n * badFactorial n
// let rec even n = (n = 0u) || odd(n - 1u)
// and odd n = (n <> 0u) && even(n - 1u)
// let people =
// [("Adam", None);
// ("Eve", None);
// ("Cain", Some("Adam", "Eve"));
// ("Abel", Some("Adam", "Eve"))]
// // let fetch url =
// // try Some (http url)
// // with :? System.Net.WebException -> None
// let testFetch =
// match (fetch "http://www.nature.comd") with
// | Some text -> printfn "text = %s" text
// | None -> printfn "**** no web page found"
// let isLikelySecretAgent url agent =
// match (url, agent) with
// | "http://www.control.org", 99 -> true
// | "http://www.control.org", 86 -> true
// | "http://www.kaos.org", _ -> true
// | _ -> false
// let printFirst xs =
// match xs with
// | h :: t -> printfn "The first item in the list is %A" h
// | [] -> printfn "No items in the list"
// let showParents (name, parents) =
// match parents with
// | Some (dad, mum) -> printfn "%s has father %s and mother %s" name dad mum
// | None -> printfn "%s has no parents!" name
// let urlFilter3 url agent =
// match url, agent with
// | "http://www.control.org", 86 -> true
// | "http://www.kaos.org", _ -> false
// | _ -> failwith "unexpected input"
// let sign x =
// match x with
// | _ when x < 0 -> -1
// | _ when x > 0 -> 1
// | _ -> 0
// let getValue a =
// match a with
// | (("lo" | "low"), v) -> v
// | ("hi", v) | ("high", v) -> v
// | _ -> failwith "expected a both a high and low value"
// let sites = ["www.bing.com"; "www.google.com"; "search.yahoo.com"]
// let fetch url = (url, http url)
// List.map fetch sites |> ignore
// let primes = [2; 3; 5; 7]
// let primeCubes = List.map (fun n -> n * n * n) primes
// let resultOfFetch = List.map (fun url -> (url, http url)) sites
// let resultLengths = List.map (fun (_, p) -> String.length p) resultOfFetch
// let delimiters = [|' '; '\n'; '\t'; '<'; '>'; '='|]
// let getWords (s: string) = s.Split delimiters
// type MyResult =
// { Site: string;
// Lenght: int;
// Words: int;
// Links: int }
// let getStats site =
// let url = "http://" + site
// let html = http url
// let hwords = html |> getWords
// let hrefs = html |> getWords |> Array.filter (fun s -> s = "href")
// { Site = site; Lenght = html.Length; Words = hwords.Length; Links = hrefs.Length }
// let statsResults =
// sites |> List.map getStats
// let google = http "http://www.google.com"
// let googleResults =
// google |> getWords |> Array.filter (fun s -> s = "href") |> Array.length
// let countLinks =
// getWords >> Array.filter (fun s -> printfn "%A" s; s = "href") >> Array.length
// let newGoogleResults =
// google |> countLinks
// let shift (dx, dy) (px, py) = (px + dx, py + dy)
// let shiftRight = shift (1, 0)
// let shiftUp = shift (0, 1)
// let shiftLeft = shift (-1, 0)
// let shiftDown = shift (0, -1)
// open System.Drawing
// let remap (r1:RectangleF) (r2:RectangleF) =
// let scalex = r2.Width / r1.Width
// let scaley = r2.Height / r1.Height
// let mapx x = r2.Left + (x - r1.Left) * scalex
// let mapy y = r2.Top + (y - r1.Top) * scaley
// let mapp (p:PointF) = PointF(mapx p.X, mapy p.Y)
// mapp
// let rect1 = RectangleF(100.0f, 100.0f, 100.0f, 100.0f)
// let rect2 = RectangleF(50.0f, 50.0f, 200.0f, 200.0f)
// let mapp = remap rect1 rect2
// let sites = ["http://www.bing.com";
// "http://www.google.com";
// "http://search.yahoo.com"]
// sites |> List.iter (fun (site) -> printfn "%s, length = %d" site (http site).Length)
// open System
// let time f =
// let start = DateTime.Now
// let res = f()
// let finish = DateTime.Now
// (res, finish - start)
// let testTime =
// time (fun () -> http "http://www.newscientist.com");;
// // open System.IO
// // [ "file1.txt"; "file2.txt"; "file3.txt" ]
// // |> List.map Path.GetExtension
// open System
// let f = (Console.WriteLine : string -> unit)
// open System
// let loopUntilSaturday() =
// while (DateTime.Now.DayOfWeek <> DayOfWeek.Saturday) do
// printfn "Still working!"
// printfn "Saturday at last!"
// for (b, pj) in [("Banana 1", false); ("Banana 2", true)] do
// if pj then
// printfn "%s is in pyjamas today!" b
// open System.Text.RegularExpressions
// for m in Regex.Matches("All the Pretty Horses", "[a-zA-Z]+") do
// printfn "res = %s" m.Value
// type DiscreteEventCounter =
// { mutable Total : int;
// mutable Positive : int;
// Name : string }
// let recordEvent (s : DiscreteEventCounter) isPositive =
// s.Total <- s.Total + 1
// if isPositive then s.Positive <- s.Positive + 1
// let reportStatus (s : DiscreteEventCounter) =
// printfn "We have %d %s out of %d" s.Positive s.Name s.Total
// let newCounter nm =
// { Total = 0;
// Positive = 0;
// Name = nm }
// let longPageCounter = newCounter "long page(s)"
// let fetch url =
// let page = http url
// recordEvent longPageCounter (page.Length > 10000)
// page
// type Cell = { mutable data : int }
// let cell1 = { data = 3 }
// let cell2 = cell1
// cell1.data <- 7
// let sum n m =
// let mutable res = 0
// for i = n to m do
// res <- res + i
// res
// let generateStamp =
// let mutable count = 0
// (fun () -> count <- count + 1; count)
// type ResizeArray<'T> = System.Collections.Generic.List<'T>
// let names = new ResizeArray<string>()
// for name in ["Claire"; "Sophie"; "Jane"] do
// names.Add(name)
// let squares = new ResizeArray<int>(seq {for i in 0..100 -> i*i})
// for x in squares do
// printfn "square: %d"
// open System.Collections.Generic;;
// let capitals = new Dictionary<string, string>(HashIdentity.Structural)
// capitals.["USA"] <- "Washington"
// capitals.["Bangladesh"] <- "Dhaka"
// capitals.ContainsKey("USA")
// for kvp in capitals do
// printfn "%s has capital %s" kvp.Key kvp.Value
// open System.Collections.Generic
// let lookupName nm (dict: Dictionary<string, string>) =
// let mutable res = ""
// let foundIt = dict.TryGetValue(nm, &res)
// if foundIt then res
// else failwith "Didn't find %s" nm
// lookupName "USA" capitals
// open System.Collections.Generic
// open FSharp.Collections
// let sparseMap = new Dictionary<(int * int), float>()
// sparseMap.[(0,2)] <- 4.0
// sparseMap.[(1021,1847)] <- 9.0
// sparseMap.
// let req = System.Net.WebRequest.Create("not a URL")
// (raise (System.InvalidOperationException("not today thank you")) : unit)
// if false then 3 else failwith "hit the wall"
// if (System.DateTime.Now > failwith "not yet decided") then
// printfn "you've run out of time!"
// try
// raise (System.InvalidOperationException ("it's just not my day"))
// with
// :? System.InvalidOperationException -> printfn "caught!"
// open System.IO
// let http (url : string) =
// try
// let req = System.Net.WebRequest.Create(url)
// let resp = req.GetResponse()
// let stream = resp.GetResponseStream()
// let reader = new StreamReader(stream)
// let html = reader.ReadToEnd()
// html
// with
// | :? System.UriFormatException -> ""
// | :? System.Net.WebException -> ""
// try
// raise (new System.InvalidOperationException ("invalid operation"))
// with err -> printfn "oops, msg = '%s'" err.Message
// let httpViaTryFinally (url: string) =
// let req = System.Net.WebRequest.Create(url)
// let resp = req.GetResponse()
// try
// let stream = resp.GetResponseStream()
// let reader = new StreamReader(stream)
// let html = reader.ReadToEnd()
// html
// finally
// resp.Close()
// let httpViaUseBinding (url: string) =
// let req = System.Net.WebRequest.Create(url)
// use resp = req.GetResponse()
// let stream = resp.GetResponseStream()
// let reader = new StreamReader(stream)
// let html = reader.ReadToEnd()
// html
// exception BlockedURL of string
// let http2 url =
// if url = "http://www.kaos.org"
// then raise (BlockedURL(url))
// else http url
// try
// raise (BlockedURL ("http://www.kaos.org"))
// with
// BlockedURL url -> printfn "blocked! url = '%s'" url
// open System.IO
// let tmpFile = Path.Combine(__SOURCE_DIRECTORY__, "temp.txt")
// File.WriteAllLines(tmpFile, ["This is a test file."; "It is easy to read."])
// File.ReadAllLines tmpFile
// File.ReadAllText tmpFile
// seq { for line in File.ReadLines tmpFile do
// let words = line.Split [|' '|]
// if words.Length > 3 && words.[2] = "easy" then
// yield line }
// open System.IO
// let outp = File.CreateText "playlist.txt"
// outp.WriteLine "Enchanted"
// outp.WriteLine "Put your record on"
// outp.Close()
// let inp = File.OpenText("playlist.txt")
// inp.ReadLine()
// inp.ReadLine()
// inp.Close()
// System.Console.WriteLine "Hello World"
// System.Console.ReadLine()
// let isWord (words : string list) =
// let wordTable = Set.ofList words
// fun w -> wordTable.Contains(w)
// let isCapital = isWord ["London"; "Paris"; "Warsaw"; "Tokyo"]
// isCapital "Paris"
// let isCapitalSlow word = isWord ["London"; "Paris"; "Warsaw"; "Tokyo"] word
// let isWordSlow2 (words : string list) (word : string) =
// List.exists (fun word2 -> word = word2) words
// let isCapitalSlow2 word = isWordSlow2 ["London"; "Paris"; "Warsaw"; "Tokyo"] word
// let isWordSlow3 (words : string list) (word : string) =
// let wordTable = Set<string>(words)
// wordTable.Contains(word)
// let isWord(words : string list) =
// let wordTable = HashSet<string>(words)
// fun word -> wordTable.Contains word
// isWord ["bla"] "bla"
// open System
// type NameLookupService =
// abstract Contains : string -> bool
// let buildSimpleNameLookup (words : string list) =
// let wordTable = HashSet<_>(words)
// {new NameLookupService with
// member t.Contains w = wordTable.Contains w}
// let capitalLookup = buildSimpleNameLookup ["London"; "Paris"; "Warsaw"; "Tokyo"]
// capitalLookup.Contains "Paris"
// let rec fib n = if n <= 2 then 1 else fib (n - 1) + fib (n - 2)
// let fibFast =
// let t = new System.Collections.Generic.Dictionary<int, int>()
// let rec fibCached n =
// if t.ContainsKey n then t.[n]
// elif n <= 2 then 1
// else let res = fibCached (n - 1) + fibCached (n - 2)
// t.Add (n, res)
// res
// fun n -> fibCached n
// let time f =
// let sw = System.Diagnostics.Stopwatch.StartNew()
// let res = f()
// let finish = sw.Stop()
// (res, sw.Elapsed.TotalMilliseconds |> sprintf "%f ms")
// time(fun () -> fibFast 30)
// open System.Collections.Generic
// let memoize (f : 'T -> 'U) =
// let t = new Dictionary<'T, 'U>(HashIdentity.Structural)
// fun n ->
// if t.ContainsKey n then t.[n]
// else let res = f n
// t.Add (n, res)
// res
// let rec fibFast =
// memoize (fun n -> if n <= 2 then 1 else fibFast (n - 1) + fibFast (n - 2))
// let rec fibNotFast n =
// memoize (fun n -> if n <= 2 then 1 else fibNotFast (n - 1) + fibNotFast (n - 2)) n
// open System.Collections.Generic
// type ITable<'T, 'U> =
// abstract Item : 'T -> 'U with get
// abstract Discard : unit -> unit
// let memoizeAndPermitDiscard f =
// let lookasideTable = new Dictionary<_, _>(HashIdentity.Structural)
// {new ITable<'T, 'U> with
// member t.Item
// with get(n) =
// if lookasideTable.ContainsKey(n) then
// lookasideTable.[n]
// else
// let res = f n
// lookasideTable.Add(n, res)
// res
// member t.Discard() =
// lookasideTable.Clear()}
// #nowarn "40" // do not warn on recursive computed objects and functions
// let rec fibFast =
// memoizeAndPermitDiscard (fun n ->
// printfn "computing fibFast %d" n
// if n <= 2 then 1 else fibFast.[n - 1] + fibFast.[n - 2])
// let sixty = lazy (30 + 30)
// sixty.Force() |> ignore
// open System.Collections.Generic
// let divideIntoEquivalenceClasses keyf seq =
// // The dictionary to hold the equivalnce classes
// let dict = new Dictionary<'key, ResizeArray<'T>>()
// seq |> Seq.iter (fun v ->
// let key = keyf v
// let ok, prev = dict.TryGetValue(key)
// if ok then prev.Add(v)
// else let prev = new ResizeArray<'T>()
// dict.[key] <- prev
// prev.Add(v))
// // Return the sequence-of-sequences. Don't reveal the
// // internal collections: just reveal them as sequences
// dict |> Seq.map (fun group -> group.Key, Seq.readonly group.Value)
// let testDivide =
// divideIntoEquivalenceClasses (fun n -> n % 10) [0 .. 10]
// open System.IO
// let reader1, reader2 =
// let reader = new StreamReader(File.OpenRead("test.txt"))
// let firstLine = reader.ReadLine()
// let secondLine = reader.ReadLine()
// // Note: we close the stream reader here!
// // But we are returning function values that use the reader
// // This is very bad
// reader.Close()
// firstLine, secondLine
// let firstLine = reader1
// let secondLine = reader2
// firstLine, secondLine
// open System.IO
// let linesOfFile =
// seq { use reader = new StreamReader(File.OpenRead("test.txt"))
// while not reader.EndOfStream do
// yield reader.ReadLine() }
// type Person =
// { Name : string
// DateOfBirth : System.DateTime }
// type Company =
// { Name : string
// Address : string }
// type Dot = { X : int; Y : int}
// type Point = { X : float ; Y : float }
// let coords1 (p:Point) = (p.X, p.Y)
// let coords2 (d:Dot) = (d.X, d.Y)
// let dist p = sqrt(p.X * p.X + p.Y * p.Y)
// let anna = ({Name = "Anna"; DateOfBirth = new System.DateTime(1968, 07, 23)} : Person)
// //type Point3D = {X : float; Y : float; Z : float}
// let p1 = {X = 3.0; Y = 4.0; Z = 5.0}
// let p2 = {p1 with Z = 0.0}
// type Route = int
// type Make = string
// type Model = string
// type Transport =
// | Car of Make * Model
// | Bicycle
// | Bus of Route
// let ian = Car("BMW", "360")
// let don = [Bicycle; Bus 8]
// let peter = [Car("Ford", "Fiesta"); Bicycle]
// let averageSpeed (tr:Transport) =
// match tr with
// | Car _ -> 35
// | Bicycle -> 16
// | Bus _ -> 24
// type Proposition =
// | True
// | And of Proposition * Proposition
// | Or of Proposition * Proposition
// | Not of Proposition
// let rec eval (p:Proposition) =
// match p with
// | True -> true
// | And(p1, p2) -> eval p1 && eval p2
// | Or(p1, p2) -> eval p1 || eval p2
// | Not(p1) -> not (eval p1)
// // type 'T option =
// // | None
// // | Some of 'T
// // type 'T list =
// // | ([])
// // | (::) of 'T * 'T list
// type Tree<'T> =
// | Tree of 'T * Tree<'T> * Tree<'T>
// | Tip of 'T
// let rec sizeOfTree tree =
// match tree with
// | Tree(_, l, r) -> 1 + sizeOfTree l + sizeOfTree r
// | Tip _ -> 1
// let smallTree = Tree("1", Tree("2", Tip "a", Tip "b"), Tip "c")
// sizeOfTree smallTree
// type Point3D = Vector3D of float * float * float
// let origin = Vector3D(0., 0., 0.)
// let unitX = Vector3D(1., 0., 0.)
// let unitY = Vector3D(0., 1., 0.)
// let unitZ = Vector3D(0., 0., 1.)
// let length (Vector3D(dx, dy, dz)) = sqrt(dx * dx + dy * dy + dz * dz)
// type Node =
// { Name : string
// Links : Link list }
// and Link =
// | Dangling
// | Link of Node
// type StringMap<'T> = Map<string, 'T>
// type Projections<'T, 'U> = ('T -> 'U) * ('U -> 'T)
// let map = StringMap([("test", 1)])
// map.ContainsKey("test")
// let rec map (f: 'T -> 'U) (l: 'T list) =
// match l with
// | h :: t -> f h :: map f t
// | [] -> []
// let getFirst (a,b,c) = a
// let mapPair f g (x, y) = (f x, g y)
// ("abc", "def") < ("abc", "zys")
// compare (10,30) (10, 20)
// hash 100
// hash "abc"
// box 1
// box "abc"
// let stringObj = box "abc"
// let againString = (unbox stringObj : string)
// open System.IO
// open System.Runtime.Serialization.Formatters.Binary
// let writeValue outputStream x =
// let formatter = new BinaryFormatter()
// formatter.Serialize(outputStream, box x)
// let readValue inputStream =
// let formatter = new BinaryFormatter()
// let res = formatter.Deserialize(inputStream)
// unbox res
// open System.IO
// let addresses =
// Map.ofList ["Jeff", "123 Main Street, Redmond, WA 98052"
// "Fred", "987 Pine Road, Phila., PA 19116"
// "Mary", "PO Box 112233, Palo Alto, CA 94301"]
// let fsOut = new FileStream("Data.dat", FileMode.Create)
// writeValue fsOut addresses
// fsOut.Close()
// let fsIn = new FileStream("Data.dat", FileMode.Open)
// let res : Map<string, string> = readValue fsIn
// fsIn.Close()
// printfn "Result: %A" res
// let rec hcf a b =
// if a = 0 then b
// elif a < b then hcf a (b - a)
// else hcf (a - b) b
// hcf 18 12
// hcf 18L 12L
// let hcfGeneric (zero, sub, lessThan) =
// let rec hcf a b =
// if a = zero then b
// elif lessThan a b then hcf a (sub b a)
// else hcf (sub a b) b
// hcf
// let hcfInt = hcfGeneric (0, (-), (<))
// let hcfInt64 = hcfGeneric (0L, (-), (<))
// let hcfBigInt = hcfGeneric (0I, (-), (<))
// hcfInt 18 12
// type Numeric<'T> =
// { Zero : 'T
// Subtract : ('T -> 'T -> 'T)
// LessThan : ('T -> 'T -> bool) }
// let intOps = { Zero = 0; Subtract = (-); LessThan = (<) }
// let bigintOps = { Zero = 0I; Subtract = (-); LessThan = (<) }
// let int64Ops = { Zero = 0L; Subtract = (-); LessThan = (<) }
// let hcfGeneric (ops: Numeric<'T>) =
// let rec hcf a b =
// if a = ops.Zero then b
// elif ops.LessThan a b then hcf a (ops.Subtract b a)
// else hcf (ops.Subtract a b) b
// hcf
// let hcfInt = hcfGeneric intOps
// let hcfBigInt = hcfGeneric bigintOps
// hcfInt 18 12
// hcfBigInt 1810287116162232383039576I 1239028178293092830480239032I
// type INumeric<'T> =
// abstract Zero : 'T
// abstract Subtract : 'T * 'T -> 'T
// abstract LessThan : 'T * 'T -> bool
// let intOps =
// { new INumeric<int> with
// member ops.Zero = 0
// member ops.Subtract(x, y) = x - y
// member ops.LessThan(x, y) = x < y }
// let hcfGeneric (ops: INumeric<'T>) =
// let rec hcf a b =
// if a = ops.Zero then b
// elif ops.LessThan(a, b) then hcf a (ops.Subtract(b, a))
// else hcf (ops.Subtract(a, b)) b
// hcf
// let convertToFloat x = float x
// float 3.0 + float 1 + float 3L
// let inline convertToFloatAndAdd x y = float x + float y
// convertToFloatAndAdd 1 4
// let inline hcf a b =
// hcfGeneric
// { new INumeric<'T> with
// member ops.Zero = LanguagePrimitives.GenericZero<'T>
// member ops.Subtract(x, y) = x - y
// member ops.LessThan(x, y) = x < y }
// a b
// hcf 18 12
// hcf 18I 12I
// let xobj = (1 :> obj)
// let sobj = ("abc" :> obj) // casting up
// let bobj = box "abc"
// let downcasting = (bobj :?> string)
// let xobj = box 1
// let x = (xobj :?> string)
// // Performing Type Tests via Pattern Matching
// let checkObject(x : obj) =
// match x with
// | :? string -> printfn "The object is a string"
// | :? int -> printfn "The object is an integer"
// | _ -> printfn "The input is something else"
// checkObject (box "abc")
// let reportObject (x : obj) =
// match x with
// | :? string as s -> printfn "The input is the string '%s'" s
// | :? int as d -> printfn "The input is the integer '%d'" d
// | _ -> printfn "The input is something else"
// reportObject (box 17)
// open System
// open System.Net
// let dispose (c : IDisposable) = c.Dispose()
// let obj1 = new WebClient()
// let obj2 = new HttpListener()
// dispose obj1
// dispose obj2
// open System
// open System.IO
// let textReader =
// if DateTime.Today.DayOfWeek = DayOfWeek.Monday
// then Console.In
// else (File.OpenText("input.txt") :> TextReader)
// let getTextReader () : TextReader = (File.OpenText("input.txt") :> TextReader)
// // Flexible Types
// let disposeMany (cs : seq<#IDisposable>) =
// for c in cs do c.Dispose()
// let disposeMany (cs : seq<'T :> IDisposable>) =
// for c in cs do c.Dispose()
// type PingPong = Ping | Pong
// let printSecondElements (inp : seq<PingPong * int>) =
// inp
// |> Seq.iter (fun (x,y) -> printfn "y = %d" x)
// let empties : int list [] = Array.create 100 []
// let emptyList = []
// let initialList = ([], [2])
// let listOfEmptyLists = [[]; []]
// let makeArray () = Array.create 100 []
// let mapFirst inp = inp |> List.map (fun (x, y) -> x)
// let printFstElements = List.map fst >> List.iter (printf "res = %d")
// let printFstElements inp = inp |> List.map fst |> List.iter (printf "res = %d")
// let empties () = Array.create 100 []
// let intEmpties : int list [] = empties ()
// let stringEmpties : string list [] = empties ()
// let emptyLists = Seq.init 100 (fun (_) -> [])
// let emptyLists<'T> : seq<'T list> = Seq.init 100 (fun (_) -> [])
// Seq.length emptyLists
// let twice x = (x + x)
// let twiceFloat (x : float) = x + x
// let threeTimes x = (x + x + x)
// let sixTimesInt64 (x:int64) = threeTimes x + threeTimes x
// // Getting Started with Objects and Members
// type Vector2d =
// { DX: float; DY: float }
// /// Get the length of the vector
// member v.Length = sqrt(v.DX * v.DX + v.DY * v.DY)
// /// Return a vector scaled by the given factor
// member v.Scale k = { DX = k * v.DX; DY = k * v.DY }
// /// Return a vector shifted by the given delta in the X coordinate
// member v.ShiftX x = { v with DX = v.DX + x }
// /// Return a vector shifted by the given delta in the Y coordinate
// member v.ShiftY y = { v with DY = v.DY + y}
// /// Return a vector shifted by the given distance in both coordinates
// member v.ShiftXY (x, y) = { DX = v.DX + x; DY = v.DY + y }
// /// Get the zero vector
// static member Zero = { DX = 0.0; DY = 0.0 }
// /// Return a contant vector along the X axis
// static member ConstX dx = { DX = dx; DY = 0.0 }
// /// Return a contant vector along the Y axis
// static member ConstY dy = { DX = 0.0; DY = dy }
// /// A type of binary tree, generic in the type of values carried at notes
// type NewTree<'T> =
// | Node of 'T * NewTree<'T> * NewTree<'T>
// | Tip
// member t.Size =
// match t with
// | Node(_, l, r) -> 1 + l.Size + r.Size
// | Tip -> 0
// type UnitVector2D(dx, dy) =
// let tolerance = 0.000001
// let lenght = sqrt (dx * dx + dy * dy)
// do
// printfn length;
// if abs (lenght - 1.0) >= tolerance then failwith "not a unit vector"
// member v.DX = dx
// member v.DY = dy
// new() = UnitVector2D(1.0, 1.0)
let main argv =
printfn "%A" argv
0 // return an exit code
when I will remove all commented code everything is working, so somehow commented code is a reason for it.
same code without comments:
module Examples
let main argv =
printfn "%A" argv
0 // return an exit code
working just fine:
Resolving startup promise because FSAC printed the 'listener started' message
[I] 2017-02-10T14:27:08.5385010Z: listener started in 63.447 ms with binding 127.0.0.1:8102 [Suave.Tcp.tcpIpServer]
I have one specific file which is reason of throwing such error:
the source code responsible for such error is:
when I will remove all commented code everything is working, so somehow commented code is a reason for it.
same code without comments:
working just fine: