Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complaints about missing System.Globalization assembly #9

Open
vilinski opened this issue Sep 30, 2019 · 2 comments
Open

Complaints about missing System.Globalization assembly #9

vilinski opened this issue Sep 30, 2019 · 2 comments

Comments

@vilinski
Copy link

The following code brings the compiler error:

Compilation failed.
(22,8)-(22,13) The type referenced through 'System.Globalization.CultureInfo' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Globalization'.
printfn "Hello, world!"

let mul a b = a * b

let a = 42
let b = 2
let c = mul a b
printfn "%i * %i = %i" a b c

type Calculation =
    | Literal of int
    | Mul of Calculation * Calculation
    | Plus of Calculation * Calculation
    | Minus of Calculation * Calculation

let rec eval calc = 
    match calc with
    | Literal i -> i
    | Mul(a,b) -> eval a * eval b
    | Plus(a,b) -> eval a + eval b
    | Minus(a,b) -> eval a - eval b
let rec print calc =
    match calc with
    | Literal i -> string i
    | Mul(a,b) -> sprintf "(%s * %s)" (print a) (print b)
    | Plus(a,b) -> sprintf "(%s + %s)" (print a) (print b)
    | Minus(a,b) -> sprintf "(%s - %s)" (print a) (print b)
let calc = Mul(Minus(Plus(Literal 42, Literal 2), Literal 1), Literal 3)

printfn "eval %A = %i" (print calc) (eval calc)
@giuliohome
Copy link

Btw ... just replacing string i with i.ToString() makes it work

@giuliohome
Copy link

I would complain also about the Missing Timezone 🌏 implementation!

open System

let missing = 
    TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
Compilation succeeded.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TimeZoneNotFoundException: Couldn't read time zone file /usr/share/zoneinfo/Central Standard Time ---> System.IO.DirectoryNotFoundException: Could not find a part of the path "/usr/share/zoneinfo/Central Standard Time".
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) <0x3922820 + 0x00258> in <b63d6248980146f38423574ef06785b2>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) <0x395bdb0 + 0x00032> in <b63d6248980146f38423574ef06785b2>:0 
  at System.IO.File.OpenRead (System.String path) <0x395bd70 + 0x0000e> in <b63d6248980146f38423574ef06785b2>:0 
  at System.TimeZoneInfo.FindSystemTimeZoneByFileName (System.String id, System.String filepath) <0x395bbd8 + 0x00014> in <b63d6248980146f38423574ef06785b2>:0 
   --- End of inner exception stack trace ---

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants