- F-Words - Functional Programming Terms With More Than Four Letters - Calvin Bottoms
- Reactive Game Development For The Discerning Hipster - Bodil Stokke
- Erlang Patterns Matching Business Needs -- Torben Hoffman
- Equivalence Classes, xUnit.net, FsCheck, Property-Based Testing -- Mark Seemann
- Functional programming design patterns -- Scott Wlaschin
- Write Your Own Compiler in 24 Hours -- Phillip Trelford
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
//=================================== | |
// Example of using DataTables in F# | |
//=================================== | |
open System | |
open System.Data | |
//=================================== | |
// General DataTable helpers | |
// |
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
(* | |
Calculator_implementation.fsx | |
Related blog post: http://fsharpforfunandprofit.com/posts/calculator-implementation/ | |
*) | |
// ================================================ | |
// Draft of Domain from previous file | |
// ================================================ | |
module CalculatorDomain_V3 = |
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 PropertiesForDob = | |
let badAge (today:System.DateTime) (dob:System.DateTime) = | |
let dob = dob.Date // ignore time | |
let today = today.Date // ignore time | |
let ts = today.Subtract(dob) | |
ts.Days / 365 // bad implementation | |
let goodAge (today:System.DateTime) (dob:System.DateTime) = |
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
namespace AwesomeAngularMVCApp.Controllers | |
open System.Threading.Tasks | |
open System.Web | |
open System.Web.Mvc | |
open AwesomeAngularMVCApp.Models | |
open Microsoft.AspNet.Identity.Owin | |
open System.Web.Http.Owin | |
[<Authorize>] |
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
(* | |
CapabilityBasedSecurity_ConfigExample.fsx | |
An example of a simple capability-based design. | |
Related blog post: http://fsharpforfunandprofit.com/posts/capability-based-security/ | |
*) | |
/// Configuration system | |
module Config = |
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
(* | |
enterprise-tic-tac-toe.fsx | |
An example of implementing "enterprise" tic-tac-toe in a functional way. | |
Related blog post: http://fsharpforfunandprofit.com/posts/enterprise-tic-tac-toe/ | |
*) | |
open System |
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
(* | |
enterprise-tic-tac-toe-2.fsx | |
Follow up to the example of implementing "enterprise" tic-tac-toe in a functional way. | |
* Added true capability based security. | |
Related blog post: http://fsharpforfunandprofit.com/posts/enterprise-tic-tac-toe-2/ | |
*) |
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
// ================================================ | |
// DDD : Model a card game | |
// ================================================ | |
(* | |
A card is a combination of a Suit (Heart, Spade) and a Rank (Two, Three, ... King, Ace) | |
A hand is a list of cards | |
A deck is a list of cards | |
A player has a name and a hand | |
A game consists of a deck and list of players |
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
// General hints on defining types with constraints or invariants | |
// | |
// Just as in C#, use a private constructor | |
// and expose "factory" methods that enforce the constraints | |
// | |
// In F#, only classes can have private constructors with public members. | |
// | |
// If you want to use the record and DU types, the whole type becomes | |
// private, which means that you also need to provide: | |
// * a constructor function ("create"). |