A monad M is a parametric type M[T] with two operations flatMap
and unit
that have to satisfy some laws.
trait M[T] {
def flatMap[U](f: T => M[U]): M[U]
}
def unit[T](x: T): M[T]
public class AppStart | |
{ | |
private static HashSet<Assembly> Dependencies; | |
// In this method the assemblies will be loaded into internal collection. | |
public static void AppInitialize() | |
{ | |
Dependencies = new HashSet<Assembly>(); | |
LoadDependencyAssemblies(); |
private static void LoadAndInit(string assemblyPath, string className) | |
{ | |
var assembly = System.Reflection.Assembly.LoadFile(assemblyPath); | |
RuntimeHelpers.RunClassConstructor(assembly.GetType(className).TypeHandle); | |
} |
#I __SOURCE_DIRECTORY__ | |
#r "libs/NuGet.Core.dll" | |
#r "System.Xml.Linq" | |
open NuGet | |
open System | |
open System.IO | |
module NuGet = |
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### | |
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget. | |
### You can download all the binaries one-shot by just giving the BASE_URL. | |
### Script might be useful if you need Oracle JDK on Amazon EC2 env. | |
### Script is updated for every JDK release. | |
### Features:- | |
# 1. Resumes a broken / interrupted [previous] download, if any. | |
# 2. Renames the file to a proper name with including platform info. |
public static AssemblyDebugInfo ReadAssemblyDebugInfo(Assembly assembly) | |
{ | |
// Parses PE headers structure from the module base address pointer | |
var modulePtr = Marshal.GetHINSTANCE(assembly.ManifestModule); | |
var peHdrs = PeHeaders.FromUnmanagedPtr(modulePtr); | |
// Depending on whether this is 32-bit or 64-bit module, the offsets are | |
// slightly different |
/* | |
* Copyright (C) 2017 Shinya Yamaoka | |
* Licensed under the MIT License.; you may not use this file except in | |
* compliance with the license. You may obtain a copy of the License at | |
* https://opensource.org/licenses/mit-license.php | |
*/ | |
object ReaderMonad { | |
class Reader[-E, +R] private (g: E => R) { | |
def apply(env: E): R = g(env) |
(* Get the files in the right places relative to the script by running: | |
path\to\NuGet.exe install NuGetPlus.Core -ExcludeVersion -Prerelease | |
*) | |
#r "FSharp.Core" | |
#r "Microsoft.Build" | |
#r "Microsoft.Build.Framework" | |
#r "System.Xml" | |
#r "System.Xml.Linq" |
/* ncurses C++ | |
* | |
* A general purpose example of using ncurses in C++ e.g. with STL strings. | |
* I guess whatever license ncurses uses applies, otherwise public domain. | |
*/ | |
# include <algorithm> | |
# include <iostream> | |
# include <fstream> | |
# include <iterator> |