phantom
is defined as:
phantom :: (Functor f, Contravariant f) => f a -> f b
phantom = contramap (const ()) . fmap (const ())
By parametricity on phantom
, we have:
fmap k . phantom = phantom . fmap h
phantom
is defined as:
phantom :: (Functor f, Contravariant f) => f a -> f b
phantom = contramap (const ()) . fmap (const ())
By parametricity on phantom
, we have:
fmap k . phantom = phantom . fmap h
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE DeriveFoldable #-} | |
{-# LANGUAGE DeriveTraversable #-} | |
-- Inspired by: | |
-- https://github.com/fumieval/data-functor-logistic | |
-- https://gist.github.com/viercc/2e6c1d8566a6fbaf0d21c09103e60b76 | |
module Iteration where |
#!/usr/bin/env cabal | |
{- cabal: | |
build-depends: base >= 4.12 | |
, mtl | |
, distributive | |
-} | |
{-# LANGUAGE DerivingVia #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} |
{-# LANGUAGE RecordWildCards #-} | |
module ListBox | |
( ListBox | |
-- Construction | |
, new | |
-- Model definition and setup | |
, plugModel | |
-- Default renderer | |
, toElement | |
-- Appearance modifiers |
{-# LANGUAGE RecordWildCards #-} | |
module InputElement where | |
import Data.Monoid | |
import Control.Monad | |
import qualified Graphics.UI.Threepenny as UI | |
import Graphics.UI.Threepenny | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE RecordWildCards #-} | |
-- Import this module qualified. | |
module Counter | |
( Counter | |
-- Constructor | |
, new | |
-- Element renderer | |
, toElement | |
-- Setter-like |