{-# LANGUAGE DataKinds #-}
-----------------------------------------------------------------------------
-- |
-- Module      :  Data.Functor.Rep.Square
-- License     :  BSD-style (see the file LICENSE)
-- Maintainer  :  sjoerd@w3future.com
--
-----------------------------------------------------------------------------
module Data.Functor.Rep.Square where

import Data.Square
import qualified Data.Functor.Rep as R

-- |
-- > +-k→_-+
-- > |  v  |
-- > |  @  |
-- > |  v  |
-- > +--f--+
tabulate :: R.Representable f => Square '[] '[] '[(->) (R.Rep f)] '[f]
tabulate :: forall (f :: * -> *).
Representable f =>
Square '[] '[] '[(->) (Rep f)] '[f]
tabulate = forall (f :: * -> *) (g :: * -> *).
(Functor f, Functor g) =>
(f ~> g) -> Square '[] '[] '[f] '[g]
funNat forall (f :: * -> *) a. Representable f => (Rep f -> a) -> f a
R.tabulate

-- |
-- > +--f--+
-- > |  v  |
-- > |  @  |
-- > |  v  |
-- > +-k→_-+
index :: R.Representable f => Square '[] '[] '[f] '[(->) (R.Rep f)]
index :: forall (f :: * -> *).
Representable f =>
Square '[] '[] '[f] '[(->) (Rep f)]
index = forall (f :: * -> *) (g :: * -> *).
(Functor f, Functor g) =>
(f ~> g) -> Square '[] '[] '[f] '[g]
funNat forall (f :: * -> *) a. Representable f => f a -> Rep f -> a
R.index