packages feed

filepather-0.8.0.0: src/System/FilePather/Name/Once.hs

{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -Wall #-}

{- | The name @once@, targeting @()@: the constructor of a step that may appear once in a trail.

Any value of the target type has the name, as the identity.

@since 0.8.0.0
-}
module System.FilePather.Name.Once (
  OnceLike (..),
) where

import Control.Lens (Optic)

{- | A field or a constructor named @once@.

@since 0.8.0.0
-}
class OnceLike p f x x' where
  once ::
    Optic p f x x' () ()

{- | Identity

@since 0.8.0.0
-}
instance (x' ~ ()) => OnceLike p f () x' where
  once =
    id
  {-# INLINE once #-}