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
def saveUser(ds: DataSource)(user: User): UserID = { | |
// blabla | |
} | |
abstract class UserValidationError | |
case object FirstNameEmpty extends UserValidationError | |
case object LastNameEmpty extends UserValidationError | |
def createUser(saveUser: User => UserID)(firstName: String, lastName: String): ValidationNel[UserValidationError, UserID] = { | |
def validateFirstName(name: String) = if (name.isEmpty) FirstNameEmpty.fail else name.success |
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
def saveUser(ds: DataSource)(user: User): UserID = { | |
// blabla | |
} | |
abstract class UserValidationError | |
case object FirstNameEmpty extends UserValidationError | |
case object LastNameEmpty extends UserValidationError | |
def createUser(saveUser: User => UserID)(firstName: String, lastName: String): ValidationNel[UserValidationError, UserID] = { | |
def validateFirstName(name: String) = if (name.isEmpty) FirstNameEmpty.fail else name.success |
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
def saveUser(ds: DataSource)(user: User): UserID = { | |
// blabla | |
} | |
abstract class UserValidationError | |
case object FirstNameEmpty extends UserValidationError | |
case object LastNameEmpty extends UserValidationError | |
def createUser(saveUser: User => UserID)(firstName: String, lastName: String): ValidationNel[UserValidationError, UserID] = { | |
def validateFirstName(name: String) = if (name.isEmpty) FirstNameEmpty.fail else name.success |
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
f :: obj1 -> obj2 | |
class Diffable delta obj | |
applyDiff :: delta -> obj -> obj | |
instance Diffable obj1Delta obj1 | |
instance Diffable obj2Delta obj2 | |
class PipeThroughDiff o1 d1 o2 d2 where | |
pipeThroughDiff :: o1 -> d1 -> o2 -> d2 |
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 TExpr | |
= TInt Int | |
| TBool Bool | |
| TStructVal (Map String TExpr) | |
| TVar StrictText | |
| TSum [TExpr] |
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 TType = TypeInt | TypeBool | TypeVec TType | |
data TExpr a where | |
TInt :: Int -> TExpr Int | |
TBool :: Bool -> TExpr Bool | |
TIVar :: StrictText -> TExpr Int | |
TBVar :: StrictText -> TExpr Bool | |
TSum :: [TExpr Int] -> TExpr Int | |
TVecGet :: |
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
// Learn more about F# at http://fsharp.net | |
// See the 'F# Tutorial' project for more help. | |
open System.Linq | |
open System.Collections.Generic | |
open System | |
type Card = | |
| Guard |
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
T& value( ) const { | |
typedef decltype( std::addressof( storage ) ) storage_address_t; | |
typedef typename std::conditional<std::is_const<T>::value, const void, void>::type void_t; | |
typedef typename std::remove_const<storage_address_t>::type address_t; | |
return *static_cast<T*>( static_cast<void_t*>( const_cast<address_t>( std::addressof( storage ) ) ) ); | |
} |
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
namespace ErSharp { | |
public sealed class Sender<T> { | |
private BlockingCollection<T> Queue; | |
internal Sender(BlockingCollection<T> queue) { | |
Queue = queue; | |
} | |
public void Send(T value) { | |
queue.Add(value); |
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
<!doctype html> | |
<html><head></head> | |
<head> | |
<style type="text/css"> | |
div.block { | |
background-color: #36C; | |
min-width: 200px; | |
height: 100px; | |
float: left; |