(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
{-# LANGUAGE TypeFamilies #-} | |
import Data.Function (on) | |
import Control.Applicative | |
data EventData e = EventData { | |
eventId :: Int, | |
body :: Event e | |
} |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x
https://www.microsoft.com/en-us/research/wp-content/uploads/2017/03/haskell-linear-submitted.pdf | |
https://www.microsoft.com/en-us/research/wp-content/uploads/2017/03/demand-jfp-draft.pdf | |
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/12/cardinality-jfp-2.pdf | |
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/11/trees-that-grow-2.pdf | |
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/11/levity-1.pdf | |
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/11/join-points-pldi17.pdf | |
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/11/dps-submitted.pdf | |
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/11/bolingbroke-thesis.pdf | |
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/10/wand-book-chapter.pdf | |
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/10/cont-frac-spj-1984-2.pdf |
{-# LANGUAGE ConstraintKinds, DataKinds, DeriveGeneric, DerivingVia #-} | |
{-# LANGUAGE ExplicitNamespaces, FlexibleContexts, FlexibleInstances #-} | |
{-# LANGUAGE GADTs, GeneralizedNewtypeDeriving, MultiParamTypeClasses #-} | |
{-# LANGUAGE PolyKinds, ScopedTypeVariables, StandaloneDeriving #-} | |
{-# LANGUAGE TypeApplications, TypeFamilies, TypeInType, TypeOperators #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# OPTIONS_GHC -Wall #-} | |
module Data.Aeson.Generic.DerivingVia | |
( StrFun(..), Setting(..), SumEncoding'(..), DefaultOptions, WithOptions(..) | |
, -- Utility type synonyms to save ticks (') before promoted data constructors |
// Sorry for poor naming, this example was intented to explain how to use skolem capturing in practise. | |
interface Stateful<S, A> { | |
(state: S): [A, S] | |
} | |
function fmap<S, A, B>(f: (a: A) => B): (stateful: Stateful<S, A>) => Stateful<S, B> { | |
return stateful => state => { | |
const [a, nextState] = stateful(state); |