This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ไปใฎJSXใ ใจไฝๆธใใฆใใใใใใ | |
var adder1 = function(x: int): function(: int): int { | |
return function(y: int): int { return x + y; }; | |
}; | |
// ไฟบใฎๆๆกใงใ->ใงๆญปใฌใใใ | |
var adder2 = (x: int): (int) -> int -> (y: int): int -> x + y; | |
// ็ก็ใใฆsimple lambdaไฝฟใใชใใใฐใใใใชใใซ่ชญใใ | |
var adder3 = (x: int): (int) -> int -> { | |
return (y: int): int -> x + y; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let inline speak (a: ^a) = | |
let x = (^a : (member Name: string) (a)) | |
printfn "I'm %s" x | |
let y = (^a : (member talk: unit -> string) (a)) | |
printfn "I say %s" y | |
//type Duck = | |
// { Name : string } // Name is not property in F# 2.0 | |
// | |
// member x.talk() = "quackity quack" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fsiใง | |
type Hoge() = | |
member this.Piyo(i: int) = "piyo1" | |
member this.Piyo(s: string) = "piyo2" | |
let f () = | |
<@ (fun (h: Hoge) -> h.Piyo(42)) @>;; // <- ใใใจใ | |
type Hoge with |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ใญใผใซใซๅคๆฐใฎletใฏใC#ใฎvarใจๅใใใฎใจๆใฃใฆใใใฐ(ใจใใใใใฏ)ใใ | |
// var x = 42; | |
let x = 42 | |
// ้ขๆฐๅฎ็พฉใฎletใฏใC#ใง | |
// var f = new Func<int, string>(i => i.ToString()); | |
// ใจใใๆธใๆนใงใ้ขๆฐๅฎ็พฉใใงใใฆใใพใใใจ่ใใ | |
let f (i: int) = i.ToString() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Hoge | |
{ | |
// ๅฆ็็ตๆใณใผใใ่ฟใ | |
public string Piyo(...) { ... } | |
public readonly int ResultA; | |
public readonly string ResultB; | |
} | |
var code = h.Piyo(...); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace Proofcafe | |
{ | |
public static class TaskMonad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface A { | |
hoge(str:string): string; | |
} | |
interface B { | |
hoge(str:string): string; | |
} | |
class AImpl implements A { | |
hoge(str) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class Base<T> | |
{ | |
public abstract T Method(); | |
} | |
public class Sub1 : Base<int> | |
{ | |
public override int Method() { return 0; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace LangExt.Playground | |
{ | |
public sealed class LazyVal<T> | |
{ | |
T value; | |
bool hasValue = false; | |
readonly Func<T> f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel; | |
namespace LangExt.Playground | |
{ | |
public sealed class LazyVal<T> | |
{ | |
readonly Func<T> f; | |
bool hasValue = false; | |
T value; |