Skip to content

Instantly share code, notes, and snippets.

View tonymorris's full-sized avatar

Tony Morris tonymorris

View GitHub Profile

Teaching a child to not run into a fire.

When a child is ~12 months old, and learning to walk, they will likely be fascinated by fire. So fascinated that they run directly into it. The only protection the child has in this case, is constant supervision and prevention from a parent.

As the child progresses to 2-3 years old, they begin learning to talk. They will learn the word hot. The parent can then associate the vocal word "hot" to something that is hot. A parent may also associate a familiar word "ouch" with "hot" to communicate to the child a consequence of the danger. This does not alleviate the need for supervision, since the child may charge the fire anyway. Further, the child is still developing neurologically and so may simply stumble into the fire, despite comprehending the parent's warnings.

Whatever the case, the child has not yet learned what hot means. They have not felt it.

A parent may safely introduce "hotness" to a child. For example, by supervising while allowing a child to briefly to

{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE TypeFamilies #-}
-- If there were an opportunity to fix the IsList type-class...
import Control.Lens
import Data.List.NonEmpty hiding (fromList)
class FromList l f | l -> f where
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE DefaultSignatures #-}
-- A better One type-class than Relude.Container.One
import Control.Applicative
import Control.Lens
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
import Data.Bool
filter' ::
(a -> Either b c)
-> [a]
-> ([b], [c])
filter' _ [] =
([], [])
filter' f (a:as) =
let (bs, cs) = filter' f as

VH-RMV W&B

Parameters

  • Fuel: 188L (full)
  • Baggage: 45.4kg (maximum)
  • Tony: 80kg
  • Juliana: 70kg

Limits

;; Pure functional I/O using clojure
;; =================================
;;
;; Defines a grammar of three operations in `defrecord Operation` using the free monad technique
;; 1. read file
;; 2. write file
;; 3. print to standard output
;;
;; Defines I/O operations by combining the Operation grammar in `defrecord IO`
;;
skipRight ::
(a -> [a] -> ([a] -> b) -> b)
-> b
-> [a]
-> b
skipRight _ z [] =
z
skipRight f z (h:t) =
f h t (skipRight f z)
import Control.Applicative(Alternative(..), liftA2)
newtype ValidationT f a b =
ValidationT (f (Either a b))
instance Functor f => Functor (ValidationT f a) where
fmap f (ValidationT x) =
ValidationT (fmap (fmap f) x)
instance Applicative f => Applicative (ValidationT f a) where
#!/usr/bin/env runhaskell
module Main where
import Text.Printf(printf)
import Data.List(intercalate)
import Data.Bool (bool)
kg2lb =
(*2.2)