Why Do Monads Matter? « Sententia cdsmithus

non-deterministic

viaWhy Do Monads Matter? « Sententia cdsmithus.

Annonser

The Downfall of Imperative Programming | FP Complete

F# Code: Generic Monadic Map and Join using statically resolved type variables

F# Code: Generic Monadic Map and Join using statically resolved type variables.

Det här borde verkligen gå att komma längre med.

Mina försök har inte kommit längre än:

let inline map m f = (^x : (member Map: (^a -> ^b) -> ^n) m, f)

let inline bind m f = (^x : (static member Bind: ^x -> (^a -> ^b) -> ^n) m, f)

let inline (>>=) m f = (^x : (static member Bind: ^x -> (^a -> ^b) -> ^n) m, f)

Det verkar i sig fungera men inte tillsammans med extension-metoder:

type 'a Option with
     member Bind (x, fn) = match x with | None -> None | Some x -> fn x
     member x.Map (fn) = match x with | None -> None | Some x -> Some (fn x)

Bug squash: A simple implementation of formlets in F#

Frank.fs

Frank.fs.

Ryan Riley (‘Panes of glass‘) had skrivit ihop ett ‘web application interface’ i F#. 

Yesod Web Framework Book

New draft: Implementation of a General Purpose Programming Language with Dependent Types « Edwin Brady

New draft: Implementation of a General Purpose Programming Language with Dependent Types « Edwin Brady.

Abstract: ”Many components of a dependently typed programming language are by now well understood, for example the underlying type theory, type checking, unification and evaluation. How to combine these components into a realistic and usable high level language is, however, folklore, discovered anew by succesive language implementations. In this paper, I describe the implementation of a new dependently typed functional programming language, IDRIS. IDRIS is intended to be a general purpose programming language and as such provides high level concepts such as implicit syntax, type classes and do notation. I describe the high level language and the underlying type theory, and present a method for elaborating concrete high level syntax with implicit arguments and type classes into a fully explicit type theory. Furthermore, I show how this method, based on a domain specific language embedded in Haskell, facilitates the implementation of new high level language constructs.”