{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
------------------------------------------------------------------------------- |-- Module : System.IO.Error.Lens-- Copyright : (C) 2012-2014 Edward Kmett-- License : BSD-style (see the file LICENSE)-- Maintainer : Edward Kmett <ekmett@gmail.com>-- Stability : experimental-- Portability : Rank2Types------------------------------------------------------------------------------
module System.IO.Error.Lens where
import Control.Lens
import GHC.IO.Exception
import System.IO
import Foreign.C.Types-- * IOException Lenses-- | Where the error happened.location :: Lens'IOExceptionStringlocationfs = f (ioe_locations) <&> \e -> s { ioe_location = e }{-# INLINE location #-}-- | Error type specific information.description :: Lens'IOExceptionStringdescriptionfs = f (ioe_descriptions) <&> \e -> s { ioe_description = e }{-# INLINE description #-}-- | The handle used by the action flagging this error.handle :: Lens'IOException (MaybeHandle)
handlefs = f (ioe_handles) <&> \e -> s { ioe_handle = e }{-# INLINE handle #-}-- | 'fileName' the error is related to.--fileName :: Lens'IOException (MaybeFilePath)
fileNamefs = f (ioe_filenames) <&> \e -> s { ioe_filename = e }{-# INLINE fileName #-}-- | 'errno' leading to this error, if any.--errno :: Lens'IOException (MaybeCInt)
errnofs = f (ioe_errnos) <&> \e -> s { ioe_errno = e }{-# INLINE errno #-}-------------------------------------------------------------------------------- Error Types-------------------------------------------------------------------------------- | What type of error it iserrorType :: Lens'IOExceptionIOErrorTypeerrorTypefs = f (ioe_types) <&> \e -> s { ioe_type = e }{-# INLINE errorType #-}-- * IOErrorType Prisms---- (These prisms are generated automatically)makePrisms ''IOErrorType