1# haskell-scfg23[](https://builds.sr.ht/~mariusl/haskell-scfg?)45Haskell library for [scfg](https://codeberg.org/emersion/scfg).67## Usage89```haskell10{-# LANGUAGE OverloadedStrings #-}1112import Data.Scfg (13 Directive (directiveChildren, directiveName, directiveParams),14 ParseError (errorMessage),15 parse,16 )17import Data.Text (Text)18import qualified Data.Text as T19import qualified Data.Text.IO as TIO2021config :: Text22config =23 "train \"Shinkansen\" {\n\24 \ model \"E5\" {\n\25 \ max-speed 320km/h\n\26 \ weight 453.5t\n\27 \ lines-served \"Tōhoku\" \"Hokkaido\"\n\28 \ }\n\29 \ model \"E7\" {\n\30 \ max-speed 275km/h\n\31 \ weight 540t\n\32 \ lines-served \"Hokuriku\" \"Jōetsu\"\n\33 \ }\n\34 \}\n"3536main :: IO ()37main = case parse config of38 Left err -> TIO.putStrLn $ "parse error: " <> errorMessage err39 Right cfg -> do40 let models = concatMap directiveChildren cfg41 mapM_ (\m -> TIO.putStrLn $ T.unwords (directiveName m : directiveParams m)) models4243```4445## Contributing4647Feel free to send patches to my48[public-inbox](https://lists.sr.ht/~mariusl/public-inbox). Please note49what change the patch will have on the version in accordance with the50[Haskell Package Versioning Policy (PVP)](https://pvp.haskell.org/).5152## License5354MIT