Skip to content

Instantly share code, notes, and snippets.

View tonymorris's full-sized avatar

Tony Morris tonymorris

View GitHub Profile
-- Functor not Applicative
data FromIntOrBool a =
FromInt (Int -> a)
| FromBool (Bool -> a)
-- Applicative not Monad
data ZeroOrTwo a =
Zero
| Two a a
% # this will break because of tagsoup/.ghci
% git clone https://github.com/ndmitchell/tagsoup/ && cd tagsoup && cabal new-repl
Cloning into 'tagsoup'...
remote: Enumerating objects: 41, done.
remote: Counting objects: 100% (41/41), done.
remote: Compressing objects: 100% (35/35), done.
remote: Total 3860 (delta 17), reused 17 (delta 6), pack-reused 3819
Receiving objects: 100% (3860/3860), 1.37 MiB | 1.04 MiB/s, done.
Resolving deltas: 100% (2322/2322), done.
Resolving dependencies...
data List a = Nil | Cons a (List a) deriving Show
mapList :: (a -> b) -> List a -> List b
mapList =
-- delete the line below and complete the answer
error "todo"
, Run $ Battery [
"-t", "<acstatus>: <left>% (<fc=#ffcccc><timeleft></fc>)",
"--",
"-O", "AC",
"-o", "Bat",
"-h", "green",
"-l", "red",
"-a", "notify-send -u critical '!BATTERY!'"
] 10
data Store r t = Store r (r -> t)
instance Functor (Store r) where
class Functor f => Comonad f where
copoint :: f a -> a
duplicate :: f a -> f (f a)
instance Comonad (Store r) where
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE KindSignatures #-}
-- trait Identity[A] { def run: A }
import Data.Functor.Identity
data Person =
Person
Int -- age
String -- name
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE LambdaCase #-}
import Control.Lens
import Data.Bool
import Data.Maybe
-- Control.Lens.Iso#anon
anon' ::
a

Isaac training

Court sprints

Prep
  • Court sprints can be practiced in any vacant area with a hard surface
  • Ensure that there is sufficient grip on the surface
  • Wear court shoes with correct spacing in the toe box
  • Using markers, place a triangle on the ground with dimensions 5.6mx2.8mx2.8m
import Control.Lens
-- fold that targets:
-- ("def", "text")
-- when
-- * the _1 side of the tuple == "a"
-- * the _2 side of the tuple has a 1-element list
-- * the _2 side of the pair has an element (which is a pair) with the fst side == "abc"
-- * the _3 side of the tuple has either a 1-element or 2-element list
foldRight' ::
(b -> z -> z)
-> (a -> b)
-> z
-> [a]
-> z
foldRight' _ _ z [] =
z
foldRight' k f z (x:xs) =
k (f x) (foldRight' k f z xs)