{-# language DeriveFunctor, DeriveFoldable, DeriveTraversable #-}
{-# language GeneralizedNewtypeDeriving #-}
{-# language ScopedTypeVariables, TypeApplications #-}
{-# language FlexibleInstances, MultiParamTypeClasses, TemplateHaskell, TypeFamilies #-}
module Language.Python.Syntax.Ann
( Ann(..)
, annot_
, HasAnn(..)
)
where
import Control.Lens.Lens (Lens')
import Control.Lens.TH (makeWrapped)
import Control.Lens.Wrapped (_Wrapped)
import Data.Deriving (deriveEq1, deriveOrd1, deriveShow1)
import Data.Semigroup (Semigroup)
import Data.Monoid (Monoid)
newtype Ann a = Ann { getAnn :: a }
deriving (Eq, Ord, Show, Functor, Foldable, Traversable, Semigroup, Monoid)
class HasAnn s where
annot :: Lens' (s a) (Ann a)
instance HasAnn Ann where
annot = id
annot_ :: HasAnn s => Lens' (s a) a
annot_ = annot._Wrapped
makeWrapped ''Ann
deriveEq1 ''Ann
deriveOrd1 ''Ann
deriveShow1 ''Ann