This file contains hidden or 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
// names and types combined | |
let someFunction (a:string) (b:int) : string = | |
a + string b | |
// type first, then name args | |
let someFunction2 : string -> int -> string = fun a b -> | |
a + string b | |
This file contains hidden or 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 #-} | |
import Control.Monad.Free | |
--data Free f a = Pure a | Free (f (Free f a)) | |
--instance Functor f => Monad (Free f) where | |
-- return = Pure | |
-- (Pure a) >>= f = f a | |
-- (Free fr) >>= f = Free (fmap (>>= f) fr) | |
-- | |
--liftF :: Functor f => f a -> Free f a |
This file contains hidden or 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
<PropertyGroup> | |
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion> | |
</PropertyGroup> | |
<Choose> | |
- <When Condition="'$(VisualStudioVersion)' == '11.0'"> | |
- <PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')"> | |
- <FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath> | |
+ <When Condition=" Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets')"> | |
+ <PropertyGroup> | |
+ <FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath> |
This file contains hidden or 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
public abstract class Thingoe { | |
public Thingoe(string id, int quantity) { ... } | |
public string Id { get; private set; } | |
public int Quantity { get; private set; } | |
} | |
public class WidgetThingoe : Thingoe { | |
public WidgetThingoe(string id, int quantity) : base(id,quantity) {} | |
} | |
public class OtherThingoe : Thingoe { |
This file contains hidden or 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 BorrowABook = | |
type BookLoanProblem = | |
NotInCatalogue | |
| OutOnLoan | |
| InsufficientPermission | |
| Failed of string | |
type Book = Book | |
type BookModel = BookModel |
This file contains hidden or 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.Collections.Generic; | |
using System.Linq; | |
using NSubstitute; | |
using NUnit.Framework; | |
using Shouldly; | |
namespace Workshop | |
{ | |
public class NSubMisc | |
{ |
This file contains hidden or 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
:set prompt "ghci> " | |
-- Configure :pf to call pointfree command line tool | |
:def pf \str -> return $ ":! pointfree \"" ++ str ++ "\"" | |
-- Hoogle | |
:def hoogle \str -> return $ ":! hoogle --count=15 \"" ++ str ++ "\"" |
This file contains hidden or 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
import Control.Arrow ((&&&)) | |
import Control.Monad.State | |
import Data.List as L | |
import Data.Map as M | |
import Data.Ord | |
import Data.Traversable | |
type Freq a = [(a,Int)] | |
freq :: Ord a => [a] -> Freq a |
This file contains hidden or 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
data Consumer i o = C { consume :: Maybe i -> Result i o } | |
data Result i o = | |
Done o | |
| Cont (Consumer i o) |
This file contains hidden or 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
Can not return value of type IFooProxy for IFoo.set_SomeString (expected type Void). | |
Make sure you called Returns() after calling your substitute (for example: mySub.SomeMethod().Returns(value)), | |
and that you are not configuring other substitutes within Returns() (for example, avoid this: mySub.SomeMethod().Returns(ConfigOtherSub())). | |
If you substituted for a class rather than an interface, check that the call to your substitute was on a virtual/abstract member. | |
Return values cannot be configured for non-virtual/non-abstract members. | |
Correct use: | |
mySub.SomeMethod().Returns(returnValue); |