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
(* | |
F# port of https://github.com/pomber/didact | |
Copyright © 2022 Victor Peter Rouven Müller | |
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: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FRO |
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
{-# LANGUAGE NamedFieldPuns #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Main where | |
newtype Bag a = Bag {content :: a} | |
deriving (Eq, Show) | |
instance Functor Bag where | |
fmap fn Bag {content} = Bag {content = fn content} |
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
#r "nuget: MathNet.Numerics" | |
#r "nuget: MathNet.Numerics.FSharp" | |
open System.Runtime.CompilerServices | |
open Checked | |
open MathNet.Numerics | |
open MathNet.Numerics.LinearAlgebra.Double | |
open MathNet.Numerics.LinearAlgebra |
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
object Bukkit { | |
import scala.concurrent.ExecutionContext | |
implicit val cs: ContextShift[IO] = IO.contextShift(ExecutionContext.global) | |
def scheduler: BukkitScheduler = JBukkit.getScheduler | |
def runTask(task: IO[Unit])(implicit plugin: JavaPlugin): BukkitTask = scheduler.runTask(plugin, Utils.mkRunnable(task.unsafeRunSync())) |
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
module Elmish.Snake | |
(** | |
Timer as a source of events with an SVG clock, by Zaid Ajaj. | |
You can find more info about Emish architecture and samples at https://elmish.github.io/ | |
*) | |
open System | |
open Fable.Import | |
open Fable.Helpers.React |
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
enum HeadMovement{ | |
case Left, Right, Keep | |
} | |
type TuringMachineTransitionTable[BandElement, AlphabetElement, State] = | |
Map[(State, BandElement), (State, AlphabetElement, HeadMovement)] | |
class InfiniteBand[BandElement, Alphabet](band:Map[Int, BandElement | Alphabet], | |
neutralElement: (BandElement | Alphabet)) { | |
var pos = 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
open System | |
open System.IO | |
open System.Diagnostics | |
let downloadDependencies deps = | |
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ | |
if not (File.Exists "paket.exe") then | |
async { | |
let url = "http://fsprojects.github.io/Paket/stable" |
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
open System | |
open System.Net | |
open System.Text.RegularExpressions | |
open System.Collections.Generic | |
// Learn more about F# at http://fsharp.org. See the 'F# Tutorial' "project" | |
// for more guidance on F# programming. | |
module Option = | |
let inline defaultMap value f option = match option with | None -> value | Some value -> f value |
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 WhoDesignedThisAnyway = | |
{ Field: string } | |
/// allocates two functions, and a tuple each time this is called. | |
static member Lens = (fun x -> x.Field), (fun v x -> {x with Field = v }) | |
module WhoDesignedThisAnyway = | |
/// doesn't allocate |
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
open System.IO | |
// Weitere Informationen zu F# unter "http://fsharp.org". | |
// Weitere Hilfe finden Sie im Projekt "F#-Tutorial". | |
module Generator = | |
open System.IO | |
open System | |
open System.Text.RegularExpressions | |
open System.CodeDom.Compiler |
NewerOlder