knapsack 3 [1,2,3]

///| | |
fn braille_from_pos(pos : Array[(Int, Int)]) -> Char { | |
let places = pos | |
.map(fn { | |
(1, 4) => 7 | |
(2, 4) => 8 | |
(1, n) => n | |
(2, n) => n + 3 | |
_ => abort("invalid position") | |
}) |
{-# LANGUAGE QuantifiedConstraints #-} | |
import Data.Kind (Type) | |
type f ~> g = forall a. f a -> g a | |
class (forall f. (Functor f) => Functor (t f)) => HFunctor t where | |
hmap :: (Functor f, Functor g) => (f ~> g) -> (t f ~> t g) | |
data FreeH (k :: (Type -> Type) -> (Type -> Type)) a where |