Skip to content

Instantly share code, notes, and snippets.

View 1tgr's full-sized avatar
💬
Loading...

Tim Robinson 1tgr

💬
Loading...
View GitHub Profile
{-# LANGUAGE DeriveDataTypeable #-}
import Data.Data
import Data.Generics.PlateData
data Child1 a = Child1 a Int
deriving (Data, Show, Typeable)
data Child2 a = Child2 a String
deriving (Data, Show, Typeable)
{-# LANGUAGE PatternGuards #-}
module Main where
import Control.Applicative
import Data.Ord
import Directory
import IO
import List
import Monad
import Network.HTTP
IEnumerable<int> nums()
{
yield return 1;
foreach (int n in nums())
yield return n+1;
}
-- a, ab, abe, al, an, ana, ant, au, ay, b, ba, bag, bar, barn, bc, be, br, bs, c, cc, cf, cher, chere, cr, cs, cw, cy, d, e, ee, eg, envy, er, et, ev, ever, f, fa, ff, fn, fo, fr, ft, fur, fw, g, gh, gl, gp, gr, gum, h, ha, i, if, il, in, ing, iv, j, je, jf, jg, jm, jp, jr, js, jt, jw, k, l, m, marne, mm, mr, my, n, na, nag, nan, nh, nl, no, nor, ny, o, oe, of, on, one, onea, ont, op, or, p, pe, pf, pj, pl, pp, ps, pure, purer, q, r, rail, re, rg, ri, rire, rr, rt, s, sa, sb, se, sg, she, sj, sn, ss, st, t, tc, te, tu, ty, u, un, v, va, vat, vi, vs, vy, w, wc, we, wf, wg, wj, wr, ws, wt, wz, x, y, z, ze
module Main where
import Char
import Control.Applicative
import qualified Data.Set as Set
import List
lowerWords :: String -> [String]
type Stringer = int -> string;;
let f : Stringer = fun n -> n.ToString();;
f 42;;
> type DoubleStringer = delegate of int -> int -> string;;
type DoubleStringer = delegate of int -> int -> string;;
-----^^^^^^^^^^^^^^
stdin(6,6): error FS0950: Delegate specifications must not be curried types. Use 'typ * ... * typ -> typ' for multi-argument delegates, and 'typ -> (typ -> typ)' for delegates returning function values.
public class Yield : Delegate
{
public Yield Invoke() { /* magic */ }
}
> let func (a : seq<'a seq>) = 5.;;
val func : seq<seq<'a>> -> float
> let a = [[4.]];;
val a : float list list = [[4.0]]
> func a;;
10 PRINT "HELLO"
20 GOTO 10
@1tgr
1tgr / fscopts_excerpt.fs
Created February 22, 2011 18:08
Undocumented command line flags for fsc and fsi
// Taken from https://github.com/fsharp/fsharp/blob/master/src/fsharp/fscopts.fs
// OptionBlock: Internal options (internal use only)
//--------------------------------------------------
let testFlag tcConfigB =
CompilerOption("test", tagString, OptionString (fun s ->
match s with
| "ErrorRanges" -> tcConfigB.errorStyle <- ErrorStyle.TestErrors
| "MemberBodyRanges" -> PostTypecheckSemanticChecks.testFlagMemberBody := true