{-# LANGUAGE DeriveDataTypeable #-}
module Language.Haskell.Ghcid.Types(
GhciError(..),
Stream(..),
Load(..), Severity(..), EvalResult(..),
isMessage, isLoading, isLoadConfig
) where
import Data.Data
import Control.Exception.Base (Exception)
data GhciError = UnexpectedExit
{ghciErrorCmd :: String
,ghciErrorMsg :: String
,ghciErrorLastStdErr :: Maybe String
}
deriving (Show, Eq, Ord, Typeable, Data)
instance Exception GhciError
data Stream = Stdout | Stderr
deriving (Show,Eq,Ord,Bounded,Enum,Read,Typeable,Data)
data Severity = Warning | Error
deriving (Show,Eq,Ord,Bounded,Enum,Read,Typeable,Data)
data Load
=
Loading
{loadModule :: String
,loadFile :: FilePath
}
|
Message
{loadSeverity :: Severity
,loadFile :: FilePath
,loadFilePos :: (Int,Int)
,loadFilePosEnd :: (Int, Int)
,loadMessage :: [String]
}
|
LoadConfig
{loadFile :: FilePath
}
|
Eval EvalResult
deriving (Show, Eq, Ord)
data EvalResult = EvalResult
{evalFile :: FilePath
,evalFilePos :: (Int, Int)
,evalCommand :: String
,evalResult :: String
}
deriving (Show, Eq, Ord)
isMessage :: Load -> Bool
isMessage Message{} = True
isMessage _ = False
isLoading :: Load -> Bool
isLoading Loading{} = True
isLoading _ = False
isLoadConfig :: Load -> Bool
isLoadConfig LoadConfig{} = True
isLoadConfig _ = False