Skip to content

Instantly share code, notes, and snippets.

@TIHan
TIHan / gist:059002027f168c86b6d4739d9d05c45b
Created May 11, 2017 20:54
msbuild AndroidFSharpSandbox
/Library/Frameworks/Mono.framework/Versions/5.0.0/lib/mono/fsharp/fsc.exe -o:obj/Debug/AndroidFSharpSandbox.dll
-g
--debug:full
--noframework
--define:DEBUG
--define:__XAMARIN_ANDROID_v1_0__;__MOBILE__;__ANDROID__;__ANDROID_1__;__ANDROID_2__;__ANDROID_3__;__ANDROID_4__;__ANDROID_5__;__ANDROID_6__;__ANDROID_7__;__ANDROID_8__;__ANDROID_9__;__ANDROID_10__;__ANDROID_11__;__ANDROID_12__;__ANDROID_13__;__ANDROID_14__;__ANDROID_15__;__ANDROID_16__;__ANDROID_17__;__ANDROID_18__;__ANDROID_19__;__ANDROID_20__;__ANDROID_21__;__ANDROID_22__;__ANDROID_23__;__ANDROID_24__;__ANDROID_25__
--optimize-
--tailcalls-
-r:/Users/williamsmith/Projects/AndroidFSharpSandbox/packages/FSharp.Core.4.1.17/lib/netstandard1.6/FSharp.Core.dll
-r:/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Java.Interop.dll
@TIHan
TIHan / gist:c55e2aed0d8fab45db9dd98319c0fcf5
Created May 11, 2017 20:54
xbuild AndroidFSharpSandbox
Tool /Library/Frameworks/Mono.framework/Versions/5.0.0/lib/mono/fsharp/fsc.exe execution started with arguments: -o:obj/Debug/AndroidFSharpSandbox.dll
-g
--debug:full
--noframework
--define:DEBUG
--define:__XAMARIN_ANDROID_v1_0__
--define:__MOBILE__
--define:__ANDROID__
--define:__ANDROID_1__
--define:__ANDROID_2__
class Benchmark
{
[Test]
public void RunTypes()
{
var cache = typeof(string).Assembly.GetTypes().ToDictionary(x => x, x => x.Name.Length);
var sum = 0;
var sw = Stopwatch.StartNew();
var n = 1000000;
for (var i = 0; i < n; i++)
namespace Styles
// Style 1; OCaml Style
module Basketball =
type T =
{
Weight: int
}
@TIHan
TIHan / fixedStruct.fs
Created February 12, 2014 05:24
An unfinished type provider to handle fixed length types; it's broken. Do not use; but here for reference.
module FSharp.BitMatch.TypeProvider
open System
open System.IO
open System.Reflection
open System.Windows.Input
open Microsoft.FSharp.Core.CompilerServices
open Microsoft.FSharp.Reflection
open Microsoft.FSharp.Quotations
module FParsec.Binary
open System
open System.Text
open System.Text.RegularExpressions
open FParsec
[<RequireQualifiedAccess>]
module File =
let readAllString path =
module WadParser
open System
open System.IO
open System.Text
open System.Text.RegularExpressions
open FParsec
[<AutoOpen>]
module FParsec =
@TIHan
TIHan / MvxViewModelTypeProvider.fs
Last active December 31, 2015 23:39
MvxViewModelTypeProvider - work in progress - still being developed, do not use in a production environment lol
(*
Copyright (c) 2013 William F. Smith
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@TIHan
TIHan / Math.fs
Last active March 21, 2020 21:15
Common, fast, and simple math functions for F#. Being developed out of game engine design.
(*
Copyright (c) 2013 William F. Smith
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@TIHan
TIHan / inline_math.fs
Last active December 27, 2015 04:48
Sample Inline Math Function Testing
module FSharpSandbox2.Main
open System
open System.Runtime.InteropServices
/// Vector3
#if MATH_RECORD_TYPES
[<StructLayout (LayoutKind.Sequential)>]
type Vector3 =
{ X: single; Y: single; Z: single }