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
// Original code posted in fsharp-opensource discussion: | |
// https://groups.google.com/forum/#!topic/fsharp-opensource/pI73-GkoxbY | |
namespace Blah | |
open System.Runtime.InteropServices | |
[<Struct>] | |
type vec3_t = |
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
// This was the idea. Unfortunately, it doesn't work. The expression expects every successive item to be | |
// the same type the first expression, ProvidedProperty. I can upcast them all to MemberInfo, but then they | |
// don't work as arguments to the next items in the expression. | |
let createType name (parameters:obj[]) = | |
let providedAsmPath = Path.Combine(config.TemporaryFolder, "FixedLengthTypes.dll") | |
let providedAsm = ProvidedAssembly(providedAsmPath) | |
let length = parameters.[0] :?> int | |
let ty = ProvidedTypeDefinition(asm, "FixedLengthTypes", name, Some typeof<obj>, IsErased = false) | |
ty.AddMembers(list { | |
yield ProvidedProperty("Length", typeof<int>, IsStatic = true, |
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
// I'm using lots of operating overloading voodoo to avoid | |
// having to specify static type constraints manually. | |
// I'm also using MemoryStream / BinaryReader which is probably | |
// slow but it was the easiest way to read values sequentially. | |
// It's currently just using the size of the receiving datatype | |
// rather than specifying it, though that could change. | |
open System | |
open System.IO | |
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
(* | |
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: |
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
type FileChange = | |
| Changed of string | |
| Deleted of string | |
| Created of string | |
| Renamed of string * string | |
let watch folder = | |
async { | |
use fsw = new System.IO.FileSystemWatcher(folder, "*.fsx", EnableRaisingEvents = true) | |
NewerOlder