packages feed

spiros 0.4.0 → 0.4.2

raw patch · 15 files changed

+765/−210 lines, 15 filesdep +th-lift-instancesdep −vectorbinary-addedPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: th-lift-instances

Dependencies removed: vector

API changes (from Hackage documentation)

- Prelude.Spiros.Application: convertSpacesToHyphens :: String -> String
- Prelude.Spiros.Application: currentApplicationSpecificSubDirectory :: ApplicationInformation -> FilePath
- Prelude.Spiros.Application: getApplicationSpecificXdgDirectory :: XdgDirectory -> ApplicationInformation -> FilePath -> IO FilePath
- Prelude.Spiros.Application: getPathFromEnvironmentOrDefault :: IO FilePath -> String -> IO FilePath
- Prelude.Spiros.Application: isValidEnvironmentVariableName :: String -> Bool
- Prelude.Spiros.Application: readTextFileWith :: IO FilePath -> IO (Maybe Text)
- Prelude.Spiros.Application: removeApplicationSpecificCache :: ApplicationInformation -> IO FilePath
- Prelude.Spiros.Application: writeTextFileWith :: IO FilePath -> Text -> IO ()
- Prelude.Spiros.Utilities: index :: Integral n => [a] -> n -> Maybe a
+ Prelude.NotSpiros: (<) :: Ord a => a -> a -> Bool
+ Prelude.NotSpiros: (>) :: Ord a => a -> a -> Bool
+ Prelude.NotSpiros: infix 4 <
+ Prelude.NotSpiros: map :: () => (a -> b) -> [a] -> [b]
+ Prelude.Spiros.Application: clearApplicationSpecificCache :: ApplicationInformation -> IO FilePath
+ Prelude.Spiros.Utilities: errorM :: MonadThrow m => String -> m a
+ Prelude.Spiros.Utilities: ordNub :: Ord a => [a] -> [a]
+ Prelude.Spiros.Utilities: ordNubBy :: Ord b => (a -> b) -> [a] -> [a]
+ Prelude.Spiros.Utilities: toLazyByteString :: StrictBytes -> LazyBytes

Files

+ CHANGELOG.md view
@@ -0,0 +1,2 @@+# `spiros`+
README.md view
@@ -1,72 +0,0 @@-[![Build Status](https://secure.travis-ci.org/sboosali/spiros.svg)](http://travis-ci.org/sboosali/spiros)-[![Hackage](https://img.shields.io/hackage/v/spiros.svg)](https://hackage.haskell.org/package/spiros)--# spiros--my custom prelude--[reverse dependencies](http://packdeps.haskellers.com/reverse/spiros)--# Notes--[Haskell CPP Macros](http://www.edsko.net/2014/09/13/haskell-cpp-macros/): --# Checking for minimal package versions--    #if MIN_VERSION_process(1,2,0)-        -- ...-    #else-        -- ...-    #endif--## Checking GHC version--either indirectly via `base`:--    #if MIN_VERSION_base(4,7,0)--or directly:--    #if MIN_VERSION_GLASGOW_HASKELL(7,6,0,0)--or, with an older macro:--    #if __GLASGOW_HASKELL__ >= 706--# Checking host platform--    #if defined(mingw32_HOST_OS)-    #if defined(cygwin32_HOST_OS) -    #if defined(darwin_HOST_OS)-    #if defined(aix_HOST_OS)--# Custom macros--In your Cabal file, [1] add a custom flag:--    Flag development-      Description:   Turn on development settings.-      Default:       False-   -that defines a custom CPP flag:--    library-      ...-      if flag(development)-        cpp-options: -DDEVELOPMENT-      ...--which you can then condition on in your Haskell files (as normal):--    #if DEVELOPMENT-    ...--Similarly, your Cabal file can set flags given the: current architecture, package versions, etc. --For example, if you need a more fine-grained check for the GHC version (__GLASGOW_HASKELL__ gives major and minor version number but not patch level) you can add--    library-      if impl(ghc == 7.6.1)-        cpp-options: -DGHC_761--# 
executables/Example/Spiros.hs view
@@ -2,15 +2,18 @@  -------------------------------------------------- +{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE DuplicateRecordFields #-}  --------------------------------------------------  {-# LANGUAGE ApplicativeDo     #-} {-# LANGUAGE DoAndIfThenElse   #-} {-# LANGUAGE PackageImports    #-}-{-# LANGUAGE RecordWildCards   #-}-{-# LANGUAGE NamedFieldPuns    #-}+{-# LANGUAGE RecordWildCards       #-}+{-# LANGUAGE NamedFieldPuns        #-}  -------------------------------------------------- @@ -32,11 +35,14 @@ import Prelude.Spiros import Prelude.Spiros.Application +import qualified "base" Prelude+ -------------------------------------------------- -- Imports (External) ---------------------------- -------------------------------------------------- -import qualified "optparse-applicative" Options.Applicative as P+import qualified "optparse-applicative" Options.Applicative      as P+import qualified "optparse-applicative" Options.Applicative.Help as P hiding (fullDesc)  -------------------------------------------------- -- Imports (Standard Library) --------------------@@ -46,19 +52,91 @@ import           "text" Data.Text (Text)  --------------------------------------------------++import qualified "base" System.Environment  as IO+import qualified "base" Control.Exception   as E++import qualified "base" Data.List as List+import qualified "base" Data.Char as Char++-------------------------------------------------- -- Types ----------------------------------------- --------------------------------------------------  data Options = Options -  { shouldPrintVersion     :: Bool-  , shouldPrintLicense     :: Bool-  , shouldPrintInformation :: Bool+  { doPrintVersion         :: Bool+  , doPrintLicense         :: Bool+  , doPrintInformation     :: Bool+  , doResolveConfiguration :: Bool++  , verbosity :: Verbosity   } -  deriving (Show)+  deriving (Show+           ,Eq,Ord+           )  --------------------------------------------------+--------------------------------------------------++data Config = Config++  { verbosity :: Verbosity+  }++  deriving (Show,Read+           ,Eq,Ord+           )++--------------------------------------------------++-- | @= 'defaultConfig'@++instance Default Config where+  def = defaultConfig++--------------------------------------------------++defaultConfig :: Config+defaultConfig = Config{..}+  where++  verbosity = def++--------------------------------------------------+--------------------------------------------------++{-| How verbose @stdout@ and @stderr@ are.++-}++data Verbosity++  = Silent+  | Concise+  | Verbose++  deriving (Enum,Bounded,Ix+           ,Show,Read+           ,Eq,Ord+           )++--------------------------------------------------++-- | @= 'defaultVerbosity'@++instance Default Verbosity where+  def = defaultVerbosity++--------------------------------------------------++-- | @= 'Concise'@++defaultVerbosity :: Verbosity+defaultVerbosity = Concise++-------------------------------------------------- -- Constants ------------------------------------- -------------------------------------------------- @@ -73,7 +151,7 @@    name0                  = "My Application"   license0               = "Apache-2.0"-  version0               = versionString+  version0               = versionStringBranch   vendor0                = "sboosali.io"    executable0            = Just "my-application"@@ -82,11 +160,11 @@  -------------------------------------------------- -versionString :: String+versionStringBranch :: String #ifdef CURRENT_PACKAGE_VERSION-versionString = CURRENT_PACKAGE_VERSION+versionStringBranch = CURRENT_PACKAGE_VERSION #else-versionString = "0.4"+versionStringBranch = "0.4" #endif  --------------------------------------------------@@ -114,37 +192,164 @@   actions :: [IO ()]   actions = concat -    [ (if shouldPrintInformation then [printInformationWith options] else [])-    , (if shouldPrintVersion then [printVersion] else [])-    , (if shouldPrintLicense then [printLicense] else [])+    [ (if doPrintInformation     then [printInformation options] else [])+    , (if doPrintVersion         then [printVersion     options] else [])+    , (if doPrintLicense         then [printLicense     options] else [])+    , (if doResolveConfiguration then [printConfig      options] else [])     ]  ----------------------------------------------------- Functions -------------------------------------+-- IO -------------------------------------------- -------------------------------------------------- -printVersion :: IO ()-printVersion = do+printVersion :: Options ->  IO ()+printVersion options@Options{..} = do -  putStrLn (application & version)+  when (verbosity == Concise) $ do+    putStrLn (application & version) +  when (verbosity >= Verbose) $ do++    versionString <- getVersionString++    let versionLine = mconcat [ (application & name), ", version ", versionString ]++    putStrLn versionLine+ -------------------------------------------------- -printLicense :: IO ()-printLicense = do+printLicense :: Options -> IO ()+printLicense options@Options{..} = do -  putStrLn (application & license)+  when (verbosity >= Verbose) $ do+    putStrLn licenseText +  when (verbosity >= Concise) $ do+    putStrLn (application & license)+ -------------------------------------------------- -printInformationWith :: Options -> IO ()-printInformationWith options = do+printInformation :: Options -> IO ()+printInformation options@Options{..} = do -  print options+  when (verbosity == Concise) $ do -  print application+    putStr "Application Information = "+    print application +    putStr "Config Directory        = "+    printConfigurationDirectory++    putStr "Data Directory          = "++    printDataDirectory+    putStr "Cache Directory         = "++  when (verbosity >= Verbose) $ do++    putH1Ln+    putStrLn "Application Information...\n"+    putH2Ln++    print application++    putH2Ln++    putStr "XDG_CONFIG_HOME/... — "+    printConfigurationDirectory+    putStr "XDG_DATA_HOME/...   — "+    printDataDirectory+    putStr "XDG_CACHE_HOME/...  — "+    printCacheDirectory++    putH1Ln+    putStrLn "Invocation Information...\n"+    putH2Ln++    print options++    putH1Ln+    putStrLn "Configuration Information...\n"+    putH2Ln++    config <- resolveConfig+    print config++    putH1Ln+ --------------------------------------------------++printConfigurationDirectory :: IO ()+printConfigurationDirectory = do++  path <- getConfigFile ""+  putStrLn path++--------------------------------------------------++printDataDirectory :: IO ()+printDataDirectory = do++  path <- getDataFile ""+  putStrLn path++--------------------------------------------------++printCacheDirectory :: IO ()+printCacheDirectory = do++  path <- getCacheFile ""+  putStrLn path++--------------------------------------------------++printConfig :: Options -> IO ()+printConfig options@Options{..} = do++  config <- resolveConfig++  when (verbosity >= Concise) $ do+    print config++--------------------------------------------------++resolveConfig :: IO Config+resolveConfig = do++  fpConfig <- getConfigFile "Config.hs"++  sConfig <- (Prelude.readFile fpConfig) `E.catch` (\(_e :: E.IOException) -> return "")++  let config = parseConfig sConfig++  return config++--------------------------------------------------++getVersionString :: IO String+getVersionString = do++  evLongVersion <- IO.lookupEnv "LongVersion"++  --TODO...+  -- currentTimestamp <- _ -- shell "date +%Y%m%d%H%M"+  -- currentGitCommit <- _ -- shell "git rev-parse --verify HEAD"++  let versionStringTags = evLongVersion & maybe "" parseVersionTags++  let versionString = versionStringBranch ++ versionStringTags++  return versionString++  where++  parseVersionTags s0 = s2+    where++    s1 = s0 & filter (not . Char.isSpace)+    s2 = if List.null s1 then "" else ("-" ++ s1)++-------------------------------------------------- -- CLI ------------------------------------------- -------------------------------------------------- @@ -161,25 +366,44 @@ options :: P.Parser Options options = do -  shouldPrintVersion <- P.switch (mconcat+  verbosity <- (P.flag Concise Verbose) (mconcat +        [ P.long  "verbose"+        , P.short 'v'+        , P.help "Enable verbose messages. (Includes printing the config that's derived from the invokation of this command: ① parsing these command-line options; and ② defaulting the values of any optional options)."+        , P.style P.bold+        ])++  doPrintVersion <- P.switch (mconcat+         [ P.long "version"         , P.help "Print the version of this program. The format is « x.y.z ». (No other text is printed. If both « --version » and « --license » are specified, all options besides « --version » are ignored.)"+        , P.style P.bold         ]) -  shouldPrintLicense <- P.switch (mconcat+  doPrintLicense <- P.switch (mconcat          [ P.long "license"         , P.help "Print the SPDX License Identifier of this program. The format is « [-.a-z0-9A-z]+ ». (No other text is printed.)"+        , P.style P.bold         ]) -  shouldPrintInformation <- P.switch (mconcat+  doPrintInformation <- P.switch (mconcat          [ P.long  "information"         , P.short 'i'         , P.help  "Print information about the application. The format is « Read »able (i.e. parseable by the Haskell « Read » typeclass)."+        , P.style P.bold         ]) +  doResolveConfiguration <- P.switch (mconcat++        [ P.long  "config"+        , P.short 'c'+        , P.help  "Print the “resolved” configuration."+        , P.style P.bold+        ])+   return Options{..}  --------------------------------------------------@@ -188,7 +412,7 @@ getOptions = do    options <- P.customExecParser preferences parser-  +   return options  --------------------------------------------------@@ -218,10 +442,57 @@   ])  --------------------------------------------------+-- Data ------------------------------------------+--------------------------------------------------++licenseText :: String+licenseText = "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2019 Sam Boosalis\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"++-------------------------------------------------- -- Paths ----------------------------------------- -------------------------------------------------- +getConfigFile :: FilePath -> IO FilePath+getConfigFile = getApplicationSpecificConfigFile application +--------------------------------------------------++getDataFile :: FilePath -> IO FilePath+getDataFile = getApplicationSpecificDataFile application++--------------------------------------------------++getCacheFile :: FilePath -> IO FilePath+getCacheFile = getApplicationSpecificCacheFile application++--------------------------------------------------+-- Utilities -------------------------------------+--------------------------------------------------++parseConfig :: String -> Config+parseConfig sConfig = iConfig+  where++  mConfig = readMaybe (trim sConfig)+  iConfig = mConfig & maybe def id++  trim+    = List.dropWhile Char.isSpace+    > reverse+    > List.dropWhile Char.isSpace+    > reverse++--------------------------------------------------++putH1Ln :: IO ()+putH1Ln = do+  putStrLn "\n========================================\n"++--------------------------------------------------++putH2Ln :: IO ()+putH2Ln = do+  putStrLn "----------------------------------------\n"  -------------------------------------------------- -- EOF -------------------------------------------
include/sboo-base-feature-macros.h view
+ library/Prelude/NotSpiros.hs view
@@ -0,0 +1,50 @@+--------------------------------------------------+-- Extensions ------------------------------------+--------------------------------------------------++{-# LANGUAGE NoImplicitPrelude #-}++{-# LANGUAGE PackageImports #-}++--------------------------------------------------+-- Options ---------------------------------------+--------------------------------------------------++{-# OPTIONS_HADDOCK not-home #-}++--------------------------------------------------++{- | 'Prelude.NotSpiros' is like 'Prelude.Spiros', but more idiomatic / conventional.++Contributors may prefer this module.++For example, it doesn't shadow the comparison operators (@('>')@ and @('<')@) with composition operators:++* 'Prelude.NotSpiros.>'+* 'Prelude.NotSpiros.<'+* 'Prelude.NotSpiros.map'++c.f.:++* 'Prelude.Spiros.>'+* 'Prelude.Spiros.<'+* 'Prelude.Spiros.map'++-}++module Prelude.NotSpiros++  ( module Prelude.NotSpiros+  , module Prelude+  ) where++--------------------------------------------------+-- Exports ---------------------------------------+--------------------------------------------------++import        Prelude.Spiros hiding ((>), (<), map)+import "base" Prelude               ((>), (<), map)++--------------------------------------------------+-- EOF -------------------------------------------+--------------------------------------------------
library/Prelude/Spiros.hs view
@@ -1,8 +1,19 @@+--------------------------------------------------+-- Extensions ------------------------------------+--------------------------------------------------+ {-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE PackageImports #-}+ --------------------------------------------------+-- Options --------------------------------------- -------------------------------------------------- +{-# OPTIONS_HADDOCK not-home #-}++--------------------------------------------------+ module Prelude.Spiros   ( -- * Re-exports@@ -65,6 +76,10 @@      "Prelude.Spiros.Exception" defines a few new exception types, which may (or may not) tag the message with a @TemplateHaskell@ 'Name' or with a 'CallStack', as auxiliary\/contextual information. +    "Prelude.Spiros.Parse" provides utilities for simple parsing of custom datatypes.++    "Prelude.Spiros.Print" provides utilities for simple pretty-printing of custom datatypes.+     "Prelude.Spiros.Validator" re-exports helpers for defining simple validators (e.g. @a -> Maybe b@).       "Prelude.Spiros.GUI" provides helpers for working with @TemplateHaskell@ 'Name's.@@ -85,6 +100,12 @@  {- $notes -Most examples (all those prefixed with a triple `@>>>@`) are @doctest@ed. Those with single `@>@` may have brittle output, and codeblocks might describe relations by "returning" variables, and thus aren't. +Most examples (all those prefixed with a triple @(>>>)@) are @doctest@ed. Those with single @(>)@ may have brittle output, and codeblocks might describe relations by "returning" variables, and thus aren't. +Contributors to any /reverse dependency/ of @spiros@ may prefer "Prelude.NotSpiros".+ -}++--------------------------------------------------+-- EOF -------------------------------------------+--------------------------------------------------
library/Prelude/Spiros/Application.hs view
@@ -18,13 +18,29 @@ -------------------------------------------------- -------------------------------------------------- -{-| Utilities for application metadata and application-specific filepaths.+{-| Utilities for organizing application metadata and exporting application-specific filepaths.  == API +Types:+ * 'ApplicationInformation'-* +* 'DesktopPlatform'+* 'ApplicationInterface' +Functions:++* `getApplicationSpecificConfigFile` — a.k.a. the @${XDG\_CONFIG\_HOME}@.+* `getApplicationSpecificDataDirectory` — a.k.a. the @${XDG\_DATA\_HOME}@.+* `getApplicationSpecificCacheDirectory` — a.k.a. the @${XDG\_CACHE\_HOME}@.+* `getApplicationSpecificRuntimeDirectory` — a.k.a. the @${XDG\_RUNTIME\_HOME}@.++== Usage++@++@+ == Links  * <https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html>@@ -34,8 +50,107 @@ -}  module Prelude.Spiros.Application-  ( module Prelude.Spiros.Application-  -- , module Application.Info++  (+    -- * Record of information for your application:++    ApplicationInformation(..)+  , ApplicationInformation0(..)++  , defaultApplicationInformation+  , defaultApplicationInformation0+  , asExecutableName++  , ApplicationInterface(..)++    -- * Enumeration of your application's supported platforms.++  , DesktopPlatform(..)++  , allDesktopPlatforms+  , currentDesktopPlatform+  , posixDesktopPlatforms++  , asMacintoshDirectory+  , asPosixDirectory+  , asWindowsDirectory++    -- * Application-specific, XDG-conformant filepaths:++    -- | XDG-conformant filepaths, specific to your application ('ApplicationInformation'), and idiomatic for your platform ('DesktopPlatform').+    --+    -- * @$XDG_CONFIG_HOME@+    -- * @$XDG_DATA_HOME@+    -- * @$XDG_CACHE_HOME@+    -- * @$XDG_RUNTIME_HOME@+    --++  , getApplicationSpecificConfigFile+  , getApplicationSpecificConfigurationDirectory++  , getApplicationSpecificDataDirectory+  , getApplicationSpecificDataFile++  , getApplicationSpecificCacheDirectory+  , getApplicationSpecificCacheFile++  , getApplicationSpecificRuntimeDirectory+  , getApplicationSpecificRuntimeFile++    -- * Read application-specific files.++  , readApplicationSpecificCacheFile+  , readApplicationSpecificConfigFile+  , readApplicationSpecificDataFile++    -- * Write application-specific files.++  , writeApplicationSpecificCacheFile+  , writeApplicationSpecificConfigFile+  , writeApplicationSpecificDataFile++    -- * @$XDG_CONFIG_HOME@ utilities:++    -- * @$XDG_DATA_HOME@ utilities:++  , listApplicationSpecificDataFiles++    -- * @$XDG_CACHE_HOME@ utilities:++  , clearApplicationSpecificCache++    -- * @$XDG_RUNTIME_HOME@ utilities:++  , touchApplicationSpecificRuntimeFile++  -- |+  --+  -- The @getMyApplication{Config,Data,Cache}Directory@ operations+  -- return this application's (platform-specific, user-writeable) directory+  -- for @{configuration files, data files, caching}@.+  --+  -- The @getMyApplication{Config,Data,Cache}Directory@ operations may throw these exceptions (all 'System.IO.IOError's):+  --+  -- * @System.IO.HardwareFault@+  -- A physical I\/O error has occurred.+  -- @[EIO]@+  --+  -- * 'System.IO.isDoesNotExistError'+  -- There is no path referring to the working directory.+  -- @[EPERM, ENOENT, ESTALE...]@+  --+  -- * 'System.IO.isPermissionError'+  -- The process has insufficient privileges to perform the operation.+  -- @[EACCES]@+  --+  -- * 'System.IO.isFullError'+  -- Insufficient resources are available to perform the operation.+  --+  -- * @UnsupportedOperation@+  -- The operating system has no notion of current working directory.+  --+  -- +   ) where  --------------------------------------------------@@ -109,10 +224,10 @@  Platform-specific metadata: -* 'platforms'             — Supported platforms (i.e. that the application is known to run on).-* 'posixDirectory'     — .-* 'windowsDirectory'   — .-* 'macintoshDirectory' — .+* 'platforms'          — Supported platforms (i.e. that the application is known to run on).+* 'posixDirectory'     — POSIX-Idiomatic naming convention (only alphanums and lowercase, see `asPosixDirectory`).+* 'windowsDirectory'   — Windows-Idiomatic naming convention (with spaces, plus the vendor name, see `asWindowsDirectory`).+* 'macintoshDirectory' — MacOS-Idiomatic naming convention (with hyphens, plus the qualified vendor URI, see `asMacintoshDirectory`).  == Example @@ -133,9 +248,9 @@   'platforms'             = 'allDesktopPlatforms'                               -- [ 'DesktopLinux', 'DesktopWindows', 'DesktopMacintosh' ] -  'posixDirectory'     = "myapplication/"-  'windowsDirectory'   = "sboosali/My Application/"-  'macintoshDirectory' = "io.sboosali.My-Application/"+  'posixDirectory'     = "myapplication\/"+  'windowsDirectory'   = "sboosali\/My Application\/"+  'macintoshDirectory' = "io.sboosali.My-Application\/" @  -}@@ -662,8 +777,8 @@      -------------------------------------------------- -removeApplicationSpecificCache :: ApplicationInformation -> IO FilePath-removeApplicationSpecificCache application = do+clearApplicationSpecificCache :: ApplicationInformation -> IO FilePath+clearApplicationSpecificCache application = do    absolutePath <- getApplicationSpecificCacheDirectory application 
library/Prelude/Spiros/Classes.hs view
@@ -557,6 +557,12 @@ -- Imports: CPP ---------------------------------- -------------------------------------------------- +#ifdef CABALFLAG_ORPHANS+import "th-lift-instances" Instances.TH.Lift()+#endif++--------------------------------------------------+ #if HAS_MONAD_FAIL import "base" Control.Monad.Fail                     as X (MonadFail(..)) #endif
library/Prelude/Spiros/Pretty.hs view
@@ -34,7 +34,7 @@ -------------------------------------------------- -------------------------------------------------- -{-|+{-| Pretty-printing and Parsing, with standard casing\/capitalization.  TODO separate packages? @@ -44,12 +44,12 @@ * @simple-parse@, which has more dependencies (like on the @exceptions@ package).  -## Description+== Description  Provides utilities (and aliases) for defining simple ad-hoc parsers and (pretty-)printers for types (especially sum types).  -## Motivation+== Motivation  Useful when: @@ -71,7 +71,7 @@   -## Features+== Features  Such "formats" include: @@ -92,7 +92,7 @@ * even manually tokenized strings.  -## Examples+== Examples  to print out a constructor, the default 'toPrinter' function does the following: @@ -103,7 +103,7 @@ 'HyphenCase' being the most readable, imo. it's most common token style for: command line options, URLs, and so on.  -## Naming+== Naming  NOTE In this package, the word "print" means "convert to a human-friendly string", not "write to stdout". 
library/Prelude/Spiros/Print.hs view
@@ -16,9 +16,10 @@ -------------------------------------------------- -------------------------------------------------- -{-| Simple printers.+{-| Simple string-based printers. -(printing, a.k.a: rendering, displaying, showing).+NOTE “Printing” here means rendering \/ displaying \/ showing+(not @stdout@ or @putStrLn@, necessarily).  -} 
library/Prelude/Spiros/Reexports.hs view
@@ -49,6 +49,7 @@  ( module X                                       -- MNEMONIC: re-eXports  , module Base  , module Prelude.Spiros.Compatibility+  ) where  --------------------------------------------------@@ -213,13 +214,13 @@ --------------------------------------------------  import "containers" Data.Set                         as X (Set)- import "containers" Data.Map                         as X (Map)-import "containers" Data.Sequence                    as X (Seq) import "containers" Data.IntSet                      as X (IntSet) import "containers" Data.IntMap                      as X (IntMap)+ import "containers" Data.Graph                       as X (Graph) import "containers" Data.Tree                        as X (Tree)+import "containers" Data.Sequence                    as X (Seq)  -------------------------------------------------- -- `template-haskell`
library/Prelude/Spiros/System.hs view
@@ -20,7 +20,7 @@ * endianness — 'currentEndianness'. * processor — 'currentProcessorBits', 'currentNumberOfCPUs'. -**TODO: respect cross-compilation, i.e. the target/runtime system.**+//TODO: respect cross-compilation, i.e. the target/runtime system.//  And information about the current compiler: 
library/Prelude/Spiros/Utilities.hs view
@@ -1,19 +1,32 @@+--------------------------------------------------+-- Extensions ------------------------------------+--------------------------------------------------+ {-# LANGUAGE CPP #-}  --------------------------------------------------  {-# LANGUAGE NoImplicitPrelude #-} +--------------------------------------------------+ {-# LANGUAGE PackageImports, TypeOperators, LambdaCase, PatternSynonyms #-}+{-# LANGUAGE BangPatterns #-}+ {-# LANGUAGE RankNTypes, PolyKinds, KindSignatures, ConstraintKinds, ScopedTypeVariables #-}+ {-# LANGUAGE GeneralizedNewtypeDeriving #-} +--------------------------------------------------+-- Options ---------------------------------------+--------------------------------------------------+ -- {-# OPTIONS_HADDOCK not-home #-}  -------------------------------------------------- -------------------------------------------------- -{-|+{-| Utilities.  These identifiers are "soft" overrides, they generalize the signatures of their @Prelude@ namesakes: @@ -33,6 +46,8 @@ #include <sboo-base-feature-macros.h>  --------------------------------------------------+-- Imports ---------------------------------------+--------------------------------------------------  import Prelude.Spiros.Types import Prelude.Spiros.Compatibility@@ -41,9 +56,13 @@ -- Imports --------------------------------------- -------------------------------------------------- ---TODO import "clock" System.Clock+import "exceptions" Control.Monad.Catch (MonadThrow(..))  --------------------------------------------------++import qualified "containers" Data.Set as Set+import           "containers" Data.Set (Set)+ --------------------------------------------------  import "mtl" Control.Monad.Reader@@ -63,8 +82,8 @@  -------------------------------------------------- --- import qualified "bytestring" Data.ByteString      as BS --- import qualified "bytestring" Data.ByteString.Lazy as BL +--import qualified "bytestring" Data.ByteString      as StrictBytes +import qualified "bytestring" Data.ByteString.Lazy as LazyBytes  -------------------------------------------------- @@ -74,7 +93,7 @@  import "base" Data.Function              ((&)) import "base" Control.Arrow              ((>>>),(<<<))-import "base" Control.Exception          (SomeException,evaluate)+import "base" Control.Exception          (SomeException,IOException,evaluate) import "base" Control.Concurrent         (threadDelay,forkIO,ThreadId) import "base" Control.Monad              (forever, void, when) import "base" Data.Proxy@@ -145,11 +164,28 @@ #endif  ----------------------------------------------------- Values ----------------------------------------+-- Types ----------------------------------------- -------------------------------------------------- +{-| A number of microseconds (there are one million microseconds per second). An integral number because it's the smallest resolution for most GHC functions. @Int@ because GHC frequently represents integrals as @Int@s (for efficiency). ++Has smart constructors for common time units; in particular, for thread delays, and for human-scale durations.++* 'microseconds'+* 'milliseconds'+* 'seconds'+* 'minutes'+* 'hours'++Which also act as self-documenting (psuedo-keyword-)arguments for 'threadDelay', via 'delayFor'. ++-}+newtype Time = Time { toMicroseconds :: Int }+ ----------------------------------------------------- soft overrides+-- Functions -------------------------------------+--------------------------------------------------+-- "soft" overrides...  -- | (generalization) -- @= 'fmap'@@@ -177,7 +213,7 @@ {-# INLINEABLE sequence_ #-}  ----------------------------------------------------- hard overrides+-- "hard" overrides...  {- | forwards composition @@ -266,11 +302,11 @@ (-:) = (,) infix 1 -: +{-# INLINEABLE (-:) #-}+ -------------------------------------------------- -------------------------------------------------- -{-# INLINEABLE (-:) #-}- todo :: a --TODO call stack todo = error "TODO" {-# DEPRECATED todo "use { __ERROR__ \"TODO\" }" #-}@@ -280,13 +316,30 @@ __BUG__ :: SomeException -> a --TODO callstack __BUG__ = error . show +{-# INLINEABLE __BUG__ #-}+ --------------------------------------------------  __ERROR__ :: String -> a --TODO callstack __ERROR__ = error  +{-# INLINEABLE __ERROR__ #-}+ --------------------------------------------------++-- | 'throwM' a 'userError' (a safer 'Prelude.error').++errorM :: (MonadThrow m) => String -> m a+errorM s = throwM e+  where++  e :: IOException+  e = userError s++{-# INLINEABLE errorM #-}+ --------------------------------------------------+--------------------------------------------------  -- | @= 'pure' ()@ @@ -371,6 +424,8 @@ #if HAS_BASE_NonEmpty nonempty2list :: NonEmpty a -> [a] nonempty2list = toList++{-# INLINEABLE nonempty2list #-} #endif  --------------------------------------------------@@ -382,6 +437,8 @@   []     -> y   (x:xs) -> f x xs +{-# INLINEABLE list #-}+ -------------------------------------------------- -------------------------------------------------- -- numbers@@ -439,8 +496,75 @@ {-# INLINEABLE (<&>) #-}  ----------------------------------------------------- list/number utilities...+-- list utilities... ++{- | Remove duplicates (from the given list).++== Examples++>>> ordNub "abcab"+"abc"+>>> ordNub ""+""++== Definition++@+ordNub = 'ordNubBy' 'id'+@++== Laws++Idempotent (i.e. multiple applications are redundant)++Stable (i.e. preserves the original order) ++== Performance++Semantically, @ordNub@ should be equivalent to 'Data.List.nub'.++Operationally, it's much faster for large lists:++* @nub@ — only needs an @Eq@ constraint, but takes @O(n^2)@ time complexity.+* @ordNub@ — needs an @Ord@ constraint, but only takes @O(n log n)@ time complexity.++== Links++* <http://github.com/nh2/haskell-ordnub>, by /Niklas Hambüchen/.++-}++ordNub :: Ord a => [a] -> [a]+ordNub = ordNubBy id++{-# INLINEABLE ordNub #-}++--------------------------------------------------++{- | Selects a key for each element, and takes the @nub@ based on that key.++See 'ordNub'.++-}++ordNubBy :: Ord b => (a -> b) -> [a] -> [a]+ordNubBy f = \l -> go Set.empty l+  where++  go !_ [] = []+  go !s (x:xs)++      | y `Set.member` s = go s xs+      | otherwise        = let !s' = Set.insert y s+                            in x : go s' xs+      where+        y = f x++{-# INLINEABLE ordNubBy #-}++--------------------------------------------------+ {- | Safely get the @n@-th item in the given list.  >>> nth 1 ['a'..'c']@@ -470,6 +594,7 @@ {-# INLINEABLE snoc #-}  --------------------------------------------------+-- number utilities...  {-| @@ -482,18 +607,7 @@ {-# INLINEABLE toInt #-}  ------------------------------------------------------ | safely-partial @(!)@-index :: (Integral n) => [a] -> n -> Maybe a-index [] _ = Nothing-index (x:xs) n- | n == 0         = Just x- | n `lessThan` 0 = Nothing- | otherwise      = index xs (n-1)--{-# INLINEABLE index #-}----------------------------------------------------+-- string utilities...  strip :: String -> String strip = rstrip . lstrip@@ -503,7 +617,7 @@ --------------------------------------------------  lstrip :: String -> String-lstrip = dropWhile (`elem` (" \t\n\r"::String))+lstrip = dropWhile (`elem` (" \t\n\r" :: String))  {-# INLINEABLE lstrip #-} @@ -615,53 +729,52 @@ runReaderT' :: r -> (ReaderT r) m a -> m a runReaderT' = flip runReaderT +{-# INLINEABLE runReaderT' #-}+ -- | @= 'flip' 'runStateT'@ runStateT' :: s -> (StateT s) m a -> m (a, s) runStateT' = flip runStateT +{-# INLINEABLE runStateT' #-}+ -- | @= 'flip' 'evalStateT'@ evalStateT' :: (Monad m) => s -> (StateT s) m a -> m a evalStateT' = flip evalStateT +{-# INLINEABLE evalStateT' #-}+ -- | @= 'flip' 'execStateT'@ execStateT' :: (Monad m) => s -> (StateT s) m a -> m s execStateT' = flip execStateT +{-# INLINEABLE execStateT' #-}+ -- | @= 'flip' 'runReader'@ runReader' :: r -> Reader r a -> a runReader' = flip runReader +{-# INLINEABLE runReader' #-}+ -- | @= 'flip' 'runState'@ runState' :: s -> State s a -> (a, s) runState' = flip runState +{-# INLINEABLE runState' #-}+ -- | @= 'flip' 'evalState'@ evalState' :: s -> State s a -> a evalState' = flip evalState +{-# INLINEABLE evalState' #-}+ -- | @= 'flip' 'execState'@ execState' :: s -> State s a -> s execState' = flip execState ------------------------------------------------------ Time--{-| A number of microseconds (there are one million microseconds per second). An integral number because it's the smallest resolution for most GHC functions. @Int@ because GHC frequently represents integrals as @Int@s (for efficiency). --Has smart constructors for common time units; in particular, for thread delays, and for human-scale durations.--* 'microseconds'-* 'milliseconds'-* 'seconds'-* 'minutes'-* 'hours'--Which also act as self-documenting (psuedo-keyword-)arguments for 'threadDelay', via 'delayFor'. ---}-newtype Time = Time { toMicroseconds :: Int }+{-# INLINEABLE execState' #-}  --------------------------------------------------+-- Time...  microseconds :: Int -> Time milliseconds :: Int -> Time@@ -830,7 +943,7 @@  -------------------------------------------------- --- {-| Return the first **numerical** (@Int@) value among the given environment variables, or a default number.+-- {-| Return the first __numerical__ (@Int@) value among the given environment variables, or a default number.  -- Examples: @@ -853,7 +966,7 @@  -------------------------------------------------- --- {-| Return the first **numerical** value among the given environment variables, or a default number.+-- {-| Return the first __numerical__ value among the given environment variables, or a default number.  -- Properties: @@ -877,7 +990,7 @@  -------------------------------------------------- -{-| Return the first **nonempty** value among the given environment variables, or a default value if all are either unset or set-to-empty.+{-| Return the first __nonempty__ value among the given environment variables, or a default value if all are either unset or set-to-empty.  Examples: @@ -933,6 +1046,14 @@   p x = if predicate x then Just x else Nothing  {-# INLINEABLE firstEnvironmentVariableSatisfying #-}++--------------------------------------------------++toLazyByteString :: StrictBytes -> LazyBytes+toLazyByteString++  = LazyBytes.fromChunks+  . (: [])  -------------------------------------------------- -- EOF -------------------------------------------
+ share/images/spiros.png view

binary file changed (absent → 154856 bytes)

spiros.cabal view
@@ -8,7 +8,7 @@ --------------------------------------------------  name:                spiros-version:             0.4.0+version:             0.4.2  --x-revision:          1 @@ -90,7 +90,10 @@  -------------------------------------------------- -extra-source-files: README.md+extra-source-files: LICENSE+                  , README.md+                  , CHANGELOG.md+                  , ./share/images/*.png  -------------------------------------------------- @@ -120,12 +123,22 @@    default:     False -  description: Exposed internals and/or dynamic typechecking (for development).+  description: Dynamic typechecking and/or exposed internals (for development).    manual:      True  -------------------------------------------------- +flag orphans++  default:     True++  description: Orphan Instances (e.g. for « Lift », via « th-lift-instances »).++  manual:      True++--------------------------------------------------+ flag static    default:     False@@ -140,7 +153,7 @@    default:     False -  description: Build the « example-spiros » executable.+  description: « example-spiros » executable.    manual:      True @@ -158,11 +171,7 @@ -- Common Stanzas -------------------------------- -------------------------------------------------- -common Haskell2020Library-- ------------------------------- default-language: Haskell2010+common Haskell2020   -----------------------------  -- cross-platform (operating system)@@ -201,9 +210,9 @@   if flag(develop)  -    cpp-options: -DDEVELOP+    cpp-options: -DCABALFLAG_DEVELOP -                 -- ^ Define the « DEVELOP » symbol (for CPP).+                 -- ^ Define the « ..._DEVELOP » symbol (for CPP).   ----------------------------- @@ -227,10 +236,18 @@  -- etc ----------------------  ----------------------------- +-------------------------------------------------- +common Haskell2020Library   ----------------------------- + if flag(orphans)+ +    cpp-options: -DCABALFLAG_ORPHANS++                 -- ^ Define the « ..._ORPHANS » symbol (for CPP).+ -------------------------------------------------- -- Library --------------------------------------- --------------------------------------------------@@ -243,14 +260,21 @@   ------------------------------ + if flag(static)++    ld-options: -static+                -pthread++ ------------------------------+  hs-source-dirs: library   ------------------------------   exposed-modules:                   --Spiros-                   Prelude.Spiros+                  Prelude.NotSpiros                    --Base.GHC710                   Prelude.Spiros.Utilities@@ -278,13 +302,6 @@   ------------------------------ - if flag(static)--    ld-options: -static-                -pthread-- -------------------------------  if impl(ghc >= 8.0)     exposed-modules:                  Prelude.Spiros.Pretty@@ -305,7 +322,7 @@   ------------------------------ - build-depends: base                 >= 4.7   && <5.0+ build-depends: base >= 4.7   && <5.0                  ----------------------------------                 -- Standard Library --------------@@ -316,7 +333,7 @@               , text               , bytestring               , containers-              , vector+--            , vector               , template-haskell     >= 2.10                  ----------------------------------@@ -333,6 +350,9 @@                 -- Extended Library --------------                 ---------------------------------- +              , th-lift-instances+                -- ^ « instance Lift Text », etc+               , exceptions >= 0.10                 -- ^ « class MonadThrow »               , data-default-class@@ -396,18 +416,33 @@                 -- / Build-Depends ---------------                 ---------------------------------- -  -- , shake-  -- , optparse-applicative >= 0.10  && <0.13-  -- , optparse-generic     >= 1.1.0 && <1.2--  -- ??+-- General-purpose packages among the GHC Boot Libraries include:+-- +-- array+-- base+-- binary+-- bytestring+-- containers+-- deepseq+-- directory+-- filepath+-- mtl+-- old-locale+-- old-time+-- parsec+-- pretty+-- process+-- random+-- stm+-- template-haskell+-- text+-- time+-- transformers+-- xhtml+-- -  -- , async-  -- , parallel+ ------------------------------ -  -- , interpolatedstring-perl6-  -- needs haskell-src-exts, which is sloooooooooow to build (~1h)-    if impl(ghc >= 8.2)     build-depends:                   deepseq      >= 1.4.3@@ -447,6 +482,8 @@  if impl(ghc >= 8.2)     ghc-options: -Wcpp-undef + ------------------------------+  -------------------------------------------------- -- Executables ----------------------------------- --------------------------------------------------@@ -465,8 +502,11 @@   ------------------------------ - default-language: Haskell2010- + if flag(static)++    ld-options: -static+                -pthread+  ------------------------------   main-is:             Main.hs@@ -484,13 +524,6 @@               , text               , optparse-applicative - -------------------------------- if flag(static)--    ld-options: -static-                -pthread-  -- ghc-options: -pgml gcc "-optl-Wl,--allow-multiple-definition" "-optl-Wl,--whole-archive" "-optl-Wl,-Bstatic" "-optl-Wl,-lXYZ" "-optl-Wl,-Bdynamic" "-optl-Wl,--no-whole-archive"     -- cc-options: -static@@ -515,6 +548,8 @@   ------------------------------ + default-language: Haskell2010+  -------------------------------------------------- -- Tests ----------------------------------------- --------------------------------------------------@@ -550,6 +585,10 @@                , doctest + ------------------------------++ default-language: Haskell2010+   -----------------------------   type: exitcode-stdio-1.0