This is a function that does some currying:
add = (a,b) ->
if not b?
return (c) ->
c + a
a + b| using System; | |
| using System.Collections.Generic; | |
| using System.Collections.Specialized; | |
| // As opposed to magic validation libraries that rely on reflection and attributes, | |
| // applicative validation is pure, total, composable, type-safe, works with immutable types, and it's easy to implement. | |
| public abstract class Result<T> { | |
| private Result() { } |
| {-# LANGUAGE OverloadedStrings #-} | |
| import qualified Network.HTTP.Conduit as H | |
| import Control.Exception | |
| import Web.Scotty | |
| import System.Environment | |
| import System.IO | |
| import System.Directory | |
| import Control.Monad | |
| import Control.Monad.IO.Class | |
| import qualified Data.ByteString.Lazy.Char8 as BS |
| (define (doit a b c) | |
| (define descending (sort (list a b c) >)) | |
| (+ (square (car descending)) (square (car (cdr descending)))) | |
| ) |
| using System; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using NUnit.Framework; | |
| using Shouldly; | |
| using System.Linq; | |
| namespace MethodInfos | |
| { | |
| public class Formatter |
| Moved to https://github.com/tonymorris/type-class |
This is a function that does some currying:
add = (a,b) ->
if not b?
return (c) ->
c + a
a + b| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| /* | |
| A basic lens library for the purpose of demonstration. | |
| Implements a lens as the costate comonad coalgebra. | |
| This library is not complete. | |
| A more complete lens library would take from |
| object SKI_Applicative { | |
| /* | |
| First, let's talk about the SK combinator calculus and how it contributes to solving your problem. | |
| The SK combinator calculus is made of two functions (aka combinators): S and K. It is sometimes called the SKI combinator calculus, | |
| however, the I combinator can be derived from S and K. The key observation of SK is that it is a turing-complete system and therefore, | |
| anything that can be expressed as SK is also turing-complete. Here is a demonstration that Scala's type system is turing-complete | |
| (and therefore, undecidable) for example[1]. | |
| The K combinator is the most trivial of the two. It is sometimes called "const" (as in Haskell). There is also some discussion about |
| class Semigroupoid cat where | |
| (<.>) :: | |
| cat a b | |
| -> cat b c | |
| -> cat a c | |
| class Semigroupoid cat => Category cat where | |
| identity :: | |
| cat a a |
I've been having a look around at various definitions of OO. Here's some of the ideas google turned up: