-----------------------------------------------------------------------------
--
-- Module      :  Data.Functor.Util
-- Copyright   :  (c) 2014-16 Brian W Bush
-- License     :  MIT
--
-- Maintainer  :  Brian W Bush <consult@brianwbush.info>
-- Stability   :  Stable
-- Portability :  Portable
--
-- | Utilities related to "Data.Functor".
--
-----------------------------------------------------------------------------


{-# LANGUAGE Safe #-}


module Data.Functor.Util (
-- * Utilities
  cast
) where


-- | Apply 'Data.Functor.fmap' twice.
cast :: (Functor f, Functor g)
     => (a -> b) -- ^ The function to be applied.
     -> f (g a)  -- ^ The nested functors.
     -> f (g b)  -- ^ The resulting nested functors.
cast = fmap . fmap