pez-0.0.1: Data/Record/Label/Prelude.hs
{-# LANGUAGE TypeOperators #-}
module Data.Record.Label.Prelude
where
import Data.Record.Label
-- First class labels pre-defined for the standard types from haskell's prelude
-- | [a]
lHead :: [a] :-> a
lHead = lens head (:)
lTail :: [a] :-> [a]
lTail = lens tail (\t-> (:t) . head)
-- | (a,b)
lFst :: (a,b) :-> a
lFst = lens fst (\a (_,b)-> (a,b))
lSnd :: (a,b) :-> b
lSnd = lens snd (\b (a,_)-> (a,b))