Added Alternative instance as well
Getty Ritter
8 years ago
| 31 | 31 | , flag |
| 32 | 32 | ) where |
| 33 | 33 | |
| 34 | import Control.Applicative (Alternative(..)) | |
| 34 | 35 | import Control.Monad.Trans.Except |
| 35 | 36 | import qualified Data.HashMap.Strict as HM |
| 36 | 37 | import Data.Ini.Config.Raw |
| 51 | 52 | -- | An 'IniParser' value represents a computation for parsing entire |
| 52 | 53 | -- INI-format files. |
| 53 | 54 | newtype IniParser a = IniParser (StParser Ini a) |
| 54 |
deriving (Functor, Applicative, |
|
| 55 | deriving (Functor, Applicative, Alternative, Monad) | |
| 55 | 56 | |
| 56 | 57 | -- | A 'SectionParser' value represents a computation for parsing a single |
| 57 | 58 | -- section of an INI-format file. |
| 58 | 59 | newtype SectionParser a = SectionParser (StParser IniSection a) |
| 59 |
deriving (Functor, Applicative, |
|
| 60 | deriving (Functor, Applicative, Alternative, Monad) | |
| 60 | 61 | |
| 61 | 62 | -- | Parse a 'Text' value as an INI file and run an 'IniParser' over it |
| 62 | 63 | parseIniFile :: Text -> IniParser a -> Either String a |