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.ServiceModel | |
open System.ServiceModel.Description | |
[<ServiceContract(ConfigurationName = "PublishService", Namespace = "http://xyz.gov/PublishService")>] | |
[<ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession)>] | |
type IPublishService = | |
[<OperationContract(Name="TestMethod")>] | |
abstract member TestMethod : name:string -> string | |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using TransducersNet; | |
namespace TransducerSample2CSharp | |
{ | |
class Program | |
{ | |
private static IEnumerable<string> asStream(string[] iterable) |
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
// https://dotnetfiddle.net/sjSjeS | |
open System | |
open System.Data | |
open System.Xml | |
open Microsoft.FSharp.Linq | |
type RowReader(reader:DataRow) = | |
member private x.Reader = reader | |
static member (?) (x:RowReader, name:string) : 'R = |
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 TrimNonEmptyString internal (value : string) = | |
member __.Value = value | |
override __.ToString() = value | |
override __.Equals(yobj) = | |
match yobj with | |
| :? TrimNonEmptyString as y -> (__.Value = y.Value) | |
| _ -> false | |
override __.GetHashCode() = hash value | |
static member TryParse (value : string) = | |
if System.String.IsNullOrWhiteSpace value then |
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
#load @"paket-files/fsprojects/Chessie/src/Chessie/ErrorHandling.fs" | |
type Continuation<'output, 'next> = 'output -> 'next | |
module TerminalDsl = | |
open Chessie.ErrorHandling | |
type Terminal<'next> = | |
| WriteLine of string * Continuation<unit, 'next> | |
| ReadLine of unit * Continuation<string, 'next> |
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 DeriveFunctor #-} | |
-- https://bartoszmilewski.com/2017/02/28/f-algebras/ | |
newtype Fix f = Fix (f (Fix f)) | |
unFix :: Fix f -> f (Fix f) | |
unFix (Fix x) = x | |
cata :: Functor f => (f a -> a) -> Fix f -> a | |
cata alg = alg . fmap (cata alg) . unFix | |
ana :: Functor f => (a -> f a) -> a -> Fix f |
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 DeriveFunctor #-} | |
-- {-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
-- {-# LANGUAGE XRankNTypes #-} | |
-- run this online https://repl.it/repls/GraciousCooperativeNijssenissdwarfchihlid | |
import Control.Applicative -- <$> | |
import Control.Monad | |
data Free f r = Free (f (Free f r)) | Pure r |
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 DeriveFunctor #-} | |
-- Is there a trick to getting this done easier? | |
-- yep, look at TryAgainFromScratch.hs | |
module Bridge where | |
import Data.List | |
import Data.Ord | |
import qualified Data.Map as Map |
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 List<'i,'r> = Nil | Cons of 'i*'r | |
type FixList<'i> = FixList of List<'i,FixList<'i>> | |
let rec fmap (f : 'a -> 'b) (l : List<'i,'a>) : List<'i,'b> = | |
match l with | |
| Nil -> Nil | |
| Cons (x, tail) -> Cons (x, f tail) | |
// you can express hylo directly without using ana and cata (by either following the |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Data; | |
using System.Windows.Documents; | |
using System.Windows.Input; |
OlderNewer