https://docs.google.com/spreadsheets/d/1ObzB9TvStARTEiFzuiu42i8MOxFHzKi6Edo1ixHrHVc/edit?usp=sharing
- Edit month and year to select the actual month
- Add the 4 times every day with optional activities
{-# LANGUAGE AllowAmbiguousTypes #-} | |
{-# LANGUAGE BlockArguments #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE TypeFamilies #-} |
{-# LANGUAGE ViewPatterns, NoMonomorphismRestriction #-} | |
-- | | |
-- - one cell to cell interaction per cycle only when at least one of them is alive | |
module Main where | |
import qualified Data.Set as S | |
import Data.Set ( Set ) |
https://docs.google.com/spreadsheets/d/1ObzB9TvStARTEiFzuiu42i8MOxFHzKi6Edo1ixHrHVc/edit?usp=sharing
{-# LANGUAGE GADTs #-} | |
-------------------------------------------------------------------------------- | |
-- U can use Control.Free.Applicative here, but implement them for your good | |
-------------------------------------------------------------------------------- | |
data Ap f b where | |
APure :: b -> Ap f b | |
Ap ::f a -> Ap f (a -> b) -> Ap f b |
-- | | |
-- Module : DeepMap | |
-- Copyright : Paolo Veronelli, 2019 | |
-- License : BSD3 | |
-- | |
-- Maintainer : [email protected] | |
-- Stability : experimental | |
-- Portability : unknown | |
-- | |
-- diffs of polytyped nested maps a.k.a. deepmap |
-- | | |
-- Module : DeepMap | |
-- Copyright : Paolo Veronelli, 2019 | |
-- License : BSD3 | |
-- | |
-- Maintainer : [email protected] | |
-- Stability : experimental | |
-- Portability : unknown | |
-- | |
-- diffs of polytyped nested maps a.k.a. deepmap |
import Test.HUnit | |
import Control.Monad | |
testMonoid :: Monoid a => Eq a => Show a => [a] -> Test | |
testMonoid ms | |
= test | |
[ "associativity" ~: sequence_ | |
[(m1 <> m2) <> m3 @?= m1 <> (m2 <> m3) | |
| [m1, m2, m3] <- replicateM 3 ms | |
] |
-- FSM parser for roman numerals from 0 to 3999 | |
module Lib where | |
import Protolude hiding (Symbol, State) | |
import Data.List (lookup) | |
import qualified Data.Map as M | |
-- roman symbols, we use them badly as symbols and levels (only some) | |
data Symbol = M | C | X | I | D | L | V deriving (Show, Enum, Eq, Read, Ord) |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
data Free f a = Layer (f (Free f a)) | Bottom a | |
deriving instance Functor f => Functor (Free f) | |
instance Functor f => Applicative (Free f) where |
data Q5 a b = Q51 a (Identity b) | Q52 [b] | |
lq5Twan :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b') | |
lq5Twan f (Q51 a bs) = Q51 a <$> traverse f bs | |
lq5Twan f (Q52 bs) = Q52 <$> traverse f bs | |
data BT tt tt' b t t' a = BT1 (tt -> b) (t a) | BT2 (tt' -> b) (t' a) deriving (Functor,Foldable,Traversable) | |
runBT (BT1 f x) = f x | |
runBT (BT2 f x) = f x |