indigo 0.2.1 → 0.2.2
raw patch · 6 files changed
+641/−2 lines, 6 filesdep +directorydep +megaparsecdep +optparse-applicativenew-component:exe:indigonew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: directory, megaparsec, optparse-applicative, process, shelly, string-interpolate, summoner, text
API changes (from Hackage documentation)
- Indigo: -- <a>Text</a>, <a>IntSet</a>, etc.) so we can't implement nice interface
- Indigo: -- associated type family instead of top-level family gives you more
- Indigo: -- control over element types.
- Indigo: -- family because some containers are monomorphic over element type (like
- Indigo: -- using old higher-kinded types approach. Implementing this as an
- Indigo: infixr 4 .~
- Indigo: infixr 7 :&
- Indigo.Backend.Prelude: -- <a>Text</a>, <a>IntSet</a>, etc.) so we can't implement nice interface
- Indigo.Backend.Prelude: -- associated type family instead of top-level family gives you more
- Indigo.Backend.Prelude: -- control over element types.
- Indigo.Backend.Prelude: -- family because some containers are monomorphic over element type (like
- Indigo.Backend.Prelude: -- using old higher-kinded types approach. Implementing this as an
- Indigo.Backend.Prelude: -- | Type of element for some container. Implemented as an asscociated type
- Indigo.Backend.Prelude: infixl 8 ...
- Indigo.Backend.Prelude: infixr 4 %~
- Indigo.Lorentz: infixr 7 :&
- Indigo.Prelude: -- <a>Text</a>, <a>IntSet</a>, etc.) so we can't implement nice interface
- Indigo.Prelude: -- associated type family instead of top-level family gives you more
- Indigo.Prelude: -- control over element types.
- Indigo.Prelude: -- family because some containers are monomorphic over element type (like
- Indigo.Prelude: -- using old higher-kinded types approach. Implementing this as an
- Indigo.Prelude: -- | Type of element for some container. Implemented as an asscociated type
- Indigo.Prelude: infixl 8 ...
- Indigo.Prelude: infixr 2 $
- Indigo.Prelude: infixr 4 .~
+ Indigo: --
+ Indigo: -- Descriptions will be checked at compile time to make sure that only
+ Indigo: -- For implementation of the check see <a>FieldDescriptionsValid</a> type
+ Indigo: -- Inline right here (default behaviour); 2. Put into definitions
+ Indigo: -- Note that we require all doc items with "in definitions" placement to
+ Indigo: -- See <a>FieldDescriptions</a> documentation for an example of usage.
+ Indigo: -- Touching this type family is costly (<tt>O(N^2)</tt>), don't use it
+ Indigo: -- and field value type. Used for error messages.
+ Indigo: -- children.
+ Indigo: -- each such entrypoint should be mentioned eariler than all of its
+ Indigo: -- existing constructors and fields are referenced.
+ Indigo: -- family.
+ Indigo: -- have <a>Eq</a> and <a>Ord</a> instances which comply the following
+ Indigo: -- law: if two documentation items describe the same entity or property,
+ Indigo: -- oblidged to often instantiate this correctly, it is only useful for
+ Indigo: -- often.
+ Indigo: -- ones, even root if necessary.
+ Indigo: -- referring to indermediate nodes (not leaves) in <tt>or</tt> tree, then
+ Indigo: -- section.
+ Indigo: -- some utilities.
+ Indigo: -- they should be considered equal.
+ Indigo: -- type.
+ Indigo: -- whenever <tt>TypeDocFieldDescriptions</tt> is not empty.
+ Indigo: infix 9 ::->
+ Indigo.Lorentz: --
+ Indigo.Lorentz: -- Descriptions will be checked at compile time to make sure that only
+ Indigo.Lorentz: -- For implementation of the check see <a>FieldDescriptionsValid</a> type
+ Indigo.Lorentz: -- Inline right here (default behaviour); 2. Put into definitions
+ Indigo.Lorentz: -- Note that we require all doc items with "in definitions" placement to
+ Indigo.Lorentz: -- See <a>FieldDescriptions</a> documentation for an example of usage.
+ Indigo.Lorentz: -- Touching this type family is costly (<tt>O(N^2)</tt>), don't use it
+ Indigo.Lorentz: -- and field value type. Used for error messages.
+ Indigo.Lorentz: -- children.
+ Indigo.Lorentz: -- each such entrypoint should be mentioned eariler than all of its
+ Indigo.Lorentz: -- existing constructors and fields are referenced.
+ Indigo.Lorentz: -- family.
+ Indigo.Lorentz: -- have <a>Eq</a> and <a>Ord</a> instances which comply the following
+ Indigo.Lorentz: -- law: if two documentation items describe the same entity or property,
+ Indigo.Lorentz: -- oblidged to often instantiate this correctly, it is only useful for
+ Indigo.Lorentz: -- often.
+ Indigo.Lorentz: -- ones, even root if necessary.
+ Indigo.Lorentz: -- referring to indermediate nodes (not leaves) in <tt>or</tt> tree, then
+ Indigo.Lorentz: -- section.
+ Indigo.Lorentz: -- some utilities.
+ Indigo.Lorentz: -- they should be considered equal.
+ Indigo.Lorentz: -- type.
+ Indigo.Lorentz: -- whenever <tt>TypeDocFieldDescriptions</tt> is not empty.
+ Indigo.Lorentz: -- | Description of constructors and fields of <tt>a</tt>.
+ Indigo.Lorentz: infix 9 ::->
+ Indigo.Lorentz: infixl 8 #
+ Indigo.Lorentz: infixr 0 :>
+ Indigo.Lorentz: infixr 1 %>
+ Indigo.Lorentz: infixr 2 &
- Indigo: -- | Type of element for some container. Implemented as an asscociated type
+ Indigo: -- | Description of constructors and fields of <tt>a</tt>.
- Indigo: data (k2 :: k) ~> (v :: k1)
+ Indigo: data (param :: k) ::-> (store :: k1)
- Indigo: infixl 4 <<$>>
+ Indigo: infixl 4 <**>
- Indigo: infixr 1 =<<
+ Indigo: infixr 1 %>
- Indigo: infixr 9 `Compose`
+ Indigo: infixr 9 .
- Indigo: type a & (b :: [Type]) = a : b
+ Indigo: type Traversal s t a b = forall (f :: Type -> Type). Applicative f => a -> f b -> s -> f t
- Indigo.Backend.Prelude: infixl 4 <<$>>
+ Indigo.Backend.Prelude: infixl 4 <**>
- Indigo.Backend.Prelude: infixr 0 $!
+ Indigo.Backend.Prelude: infixr 0 $!!
- Indigo.Backend.Prelude: infixr 2 $
+ Indigo.Backend.Prelude: infixr 2 ||
- Indigo.Backend.Prelude: infixr 9 `Compose`
+ Indigo.Backend.Prelude: infixr 9 .
- Indigo.Backend.Prelude: type family OneItem x;
+ Indigo.Backend.Prelude: type family Each (c :: [k -> Constraint]) (as :: [k])
- Indigo.Lorentz: data (k2 :: k) ~> (v :: k1)
+ Indigo.Lorentz: data (param :: k) ::-> (store :: k1)
- Indigo.Lorentz: type (n :: Symbol) ?: (a :: k) = '(n, a)
+ Indigo.Lorentz: type (name :: Symbol) :? a = NamedF Maybe a name
- Indigo.Lorentz: type family ShowUStoreField (marker :: UStoreMarkerType) v :: ErrorMessage
+ Indigo.Lorentz: type family TypeDocFieldDescriptions a :: FieldDescriptions
- Indigo.Prelude: infixl 4 <<$>>
+ Indigo.Prelude: infixl 4 <**>
- Indigo.Prelude: infixr 0 $!
+ Indigo.Prelude: infixr 0 $!!
- Indigo.Prelude: infixr 9 `Compose`
+ Indigo.Prelude: infixr 9 .
- Indigo.Prelude: type family OneItem x;
+ Indigo.Prelude: type family Each (c :: [k -> Constraint]) (as :: [k])
Files
- CHANGES.md +8/−0
- app/FileGen.hs +54/−0
- app/FileGen/Files.hs +312/−0
- app/Helper.hs +63/−0
- app/Main.hs +172/−0
- indigo.cabal +32/−2
CHANGES.md view
@@ -1,3 +1,11 @@+0.2.2+=====+* [!544](https://gitlab.com/morley-framework/morley/-/merge_requests/544)+ Add `indigo` executable which improves the development of Indigo projects.+ + Create boilerplate project via `new`.+ + Wrap around stack commands: `build`, `test`, and `repl`.+ + Run `ContractRegistry` commands via `run`.+ 0.2.1 ===== * [!570](https://gitlab.com/morley-framework/morley/-/merge_requests/570)
+ app/FileGen.hs view
@@ -0,0 +1,54 @@+-- SPDX-FileCopyrightText: 2020 Tocqueville Group+--+-- SPDX-License-Identifier: LicenseRef-MIT-TQ++-- | File Generation machinery that resembles @summoner@ library.+module FileGen+ ( run+ ) where++import System.Directory (setCurrentDirectory)+import Summoner.Tree (TreeFs(..), showBoldTree, traverseTree)++import qualified FileGen.Files as F++run :: Text -> IO ()+run projectName =+ createProjectDirectoryCustom (CustomSettings projectName)++-- | From the given 'CustomSettings' creates the project.+createProjectDirectoryCustom :: CustomSettings -> IO ()+createProjectDirectoryCustom settings@CustomSettings{..} = do+ let tree = createProjectTemplateCustom settings+ traverseTree tree+ putTextLn "The project with the following structure has been created:"+ putTextLn $ showBoldTree tree+ setCurrentDirectory (toString sProjectName)++-- | Creating tree structure of the project.+createProjectTemplateCustom :: CustomSettings -> TreeFs+createProjectTemplateCustom settings@CustomSettings{..} =+ Dir (toString sProjectName) $ generateFiles settings++-- | Files Template+generateFiles :: CustomSettings -> [TreeFs]+generateFiles CustomSettings{..} =+ [ Dir "app"+ [ File "Main.hs" F.main ]+ , Dir "src"+ [ File "Basic.hs" F.basic ]+ , Dir "test"+ [ Dir "Test"+ [ File "Basic.hs" F.basicTest ]+ , File "Main.hs" F.mainTest+ ]+ , File "ChangeLog.md" (F.changelog sProjectName)+ , File "README.md" (F.readme sProjectName)+ , File ".gitignore" F.gitignore+ , File "package.yaml" (F.packageYaml sProjectName)+ , File "stack.yaml" F.stackYaml+ ]++data CustomSettings = CustomSettings+ { sProjectName :: Text+ }
+ app/FileGen/Files.hs view
@@ -0,0 +1,312 @@+-- SPDX-FileCopyrightText: 2020 Tocqueville Group+--+-- SPDX-License-Identifier: LicenseRef-MIT-TQ++-- | List of functions that generate the files for 'FileGen'.+module FileGen.Files+ ( main+ , basic+ , mainTest+ , basicTest+ , changelog+ , readme+ , gitignore+ , packageYaml+ , stackYaml+ ) where++import Data.String.Interpolate (i)++import Helper++main :: Text+main = [i|module Main+ ( main+ ) where++import qualified Data.Map as Map+import qualified Options.Applicative as Opt+import Options.Applicative.Help.Pretty (Doc, linebreak)+import Main.Utf8 (withUtf8)+import Lorentz (DGitRevision(..))+import Lorentz.ContractRegistry+import System.Environment (withProgName)++import qualified Basic++programInfo :: DGitRevision -> Opt.ParserInfo CmdLnArgs+programInfo gitRev = Opt.info (Opt.helper <*> argParser contracts gitRev) $+ mconcat+ [ Opt.fullDesc+ , Opt.progDesc "#{indigoDesc}"+ , Opt.header "#{indigoTitle}"+ , Opt.footerDoc $ Just usageDoc+ ]++usageDoc :: Doc+usageDoc = mconcat+ [ "You can use help for specific COMMAND", linebreak+ , "EXAMPLE:", linebreak+ , " #{indigoRunCommand} print --help", linebreak+ ]++contracts :: ContractRegistry+contracts = ContractRegistry $ Map.fromList+ [ "Basic" ?:: ContractInfo+ { ciContract = Basic.basicContractLorentz+ , ciIsDocumented = True+ , ciStorageParser = Just (pure Basic.emptyStorage)+ , ciStorageNotes = Nothing+ }+ ]++main :: IO ()+main = withUtf8 $ withProgName "#{indigoRunCommand}" $ do+ cmdLnArgs <- Opt.execParser (programInfo DGitRevisionUnknown)+ runContractRegistry contracts cmdLnArgs `catchAny` (die . displayException)+|]++basic :: Text+basic = [i|module Basic+ ( basicContractLorentz+ , emptyStorage+ ) where++import Indigo+import Lorentz.Run (Contract)++basicContractLorentz :: Contract Integer Integer+basicContractLorentz = defaultContract $ compileIndigoContract basicContract++basicContract :: IndigoContract Integer Integer+basicContract param = defContract do+ storage += param++emptyStorage :: Integer+emptyStorage = 0 int++storage :: HasStorage Integer => Var Integer+storage = storageVar+|]++basicTest :: Text+basicTest = [i|module Test.Basic+ ( unit_updates_storage_properly+ ) where++import Basic (basicContractLorentz)++import Lorentz+import Lorentz.Test+import Michelson.Test.Integrational+import Michelson.Typed.Convert+import Test.Tasty.HUnit (Assertion)++unit_updates_storage_properly :: Assertion+unit_updates_storage_properly = integrationalTestExpectation $ do+ contractAddr <- originate (convertContract $ compileLorentzContract basicContractLorentz) "basic"+ (untypeValue $ toVal (10 :: Integer)) (zeroMutez)++ let+ txData = TxData+ { tdSenderAddress = genesisAddress+ , tdParameter = TxTypedParam $ toVal (90 :: Integer)+ , tdEntrypoint = DefEpName+ , tdAmount = zeroMutez+ }++ transfer txData contractAddr++ expectStorageConst contractAddr+ $ untypeValue $ toVal (100 :: Integer)+|]++mainTest :: Text+mainTest = "{-# OPTIONS_GHC -F -pgmF tasty-discover #-}\n"++changelog :: Text -> Text+changelog projectName = [i|# Changelog for #{projectName}++## Unreleased changes+|]++readme :: Text -> Text+readme projectName = [i|# #{projectName}+|]++gitignore :: Text+gitignore = unlines+ [ ".stack-work/"+ , "*~"+ ]++packageYaml :: Text -> Text+packageYaml projectName = [i|name: #{projectName}+version: 0.1.0.0+github: "githubuser/#{projectName}"+author: "Author name here"+maintainer: "example@example.com"+copyright: "2020 Author name here"++extra-source-files:+- README.md+- ChangeLog.md++description: Please see the README on GitHub at <https://github.com/githubuser/#{projectName}#readme>++verbatim:+ cabal-version: 2.2++default-extensions:+ - AllowAmbiguousTypes+ - BangPatterns+ - BlockArguments+ - ConstraintKinds+ - DataKinds+ - DefaultSignatures+ - DeriveAnyClass+ - DeriveDataTypeable+ - DeriveFoldable+ - DeriveFunctor+ - DeriveGeneric+ - DeriveTraversable+ - DerivingStrategies+ - DerivingVia+ - EmptyCase+ - FlexibleContexts+ - FlexibleInstances+ - GADTs+ - GeneralizedNewtypeDeriving+ - LambdaCase+ - MultiParamTypeClasses+ - MultiWayIf+ - NamedFieldPuns+ - NegativeLiterals+ - NumDecimals+ - OverloadedLabels+ - OverloadedStrings+ - PatternSynonyms+ - PolyKinds+ - QuasiQuotes+ - RankNTypes+ - RecordWildCards+ - RecursiveDo+ - ScopedTypeVariables+ - StandaloneDeriving+ - StrictData+ - TemplateHaskell+ - TupleSections+ - TypeApplications+ - TypeFamilies+ - TypeOperators+ - UndecidableInstances+ - UndecidableSuperClasses+ - ViewPatterns++dependencies:+ - name: base+ version: ">= 4.7 && < 5"+ mixin: [hiding (Prelude)]++ghc-options:+ - -Weverything+ - -Wno-missing-exported-signatures+ - -Wno-missing-import-lists+ - -Wno-missed-specialisations+ - -Wno-all-missed-specialisations+ - -Wno-unsafe+ - -Wno-safe+ - -Wno-missing-local-signatures+ - -Wno-monomorphism-restriction+ - -Wno-implicit-prelude++library:+ source-dirs: src+ default-extensions: [ RebindableSyntax ]+ ghc-options: [ -Wno-unused-do-bind ]++ generated-other-modules:+ - Paths_#{useUnderscore projectName}++ dependencies:+ - containers+ - fmt+ - indigo+ - lorentz+ - morley+ - morley-prelude+ - text++executables:+ #{projectName}:+ main: Main.hs+ source-dirs: app++ dependencies:+ - #{projectName}+ - containers+ - morley+ - lorentz+ - indigo+ - morley-prelude+ - optparse-applicative+ - with-utf8++tests:+ #{projectName}-test:+ main: Main.hs+ source-dirs: test+ build-tools: tasty-discover:tasty-discover+ ghc-options:+ - -threaded+ - -eventlog+ - -rtsopts+ - '"-with-rtsopts=-N -A64m -AL256m"'+ dependencies:+ - #{projectName}+ - cleveland+ - containers+ - fmt+ - hspec+ - hspec-expectations+ - HUnit+ - lorentz+ - morley+ - morley-prelude+ - tasty+ - tasty-hspec+ - tasty-hunit-compat+|]++stackYaml :: Text+stackYaml = [i|resolver: lts-16.5++packages:+ - .++extra-deps:+ - tasty-hunit-compat-0.2+ - morley-prelude-0.3.0+ - morley-1.6.0+ - lorentz-0.6.0+ - indigo-0.2.0+ - git:+ https://gitlab.com/morley-framework/morley.git+ commit:+ 3bc23ad17a0719ee96d83a94b0194ca5bfe3b8c7 # morley-1.6.0+ subdirs:+ - code/cleveland+ - code/morley-client++ - base58-bytestring-0.1.0+ - hex-text-0.1.0.0+ - show-type-0.1.1+ - git: https://github.com/int-index/caps.git+ commit: c5d61837eb358989b581ed82b1e79158c4823b1b+ - named-0.3.0.1@sha256:69b9722301201f8ed8abc89c4595e22c746e944bf4cdfafa8b21b14d336b26d1,2233+ - vinyl-0.12.1@sha256:43456d4b3009646eee63953cbe539f1f4d0caf8bc3c25e841117e712836508f3,3790+ - cryptonite-0.27++nix:+ packages: [zlib]+|]
+ app/Helper.hs view
@@ -0,0 +1,63 @@+-- SPDX-FileCopyrightText: 2020 Tocqueville Group+-- SPDX-FileCopyrightText: 2015-2020, Stack contributors+--+-- SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-License-Identifier: LicenseRef-MIT-Stack-contributors++-- | Indigo Executable Helper functions+module Helper+ ( parsePackageName+ , useUnderscore+ , indigoTitle+ , indigoDesc+ , indigoRunCommand+ ) where++import Prelude hiding (many)+import qualified Data.Text as T+import Text.Megaparsec (Parsec, eof, many, runParser, sepBy1)+import Text.Megaparsec.Char (char, digitChar, letterChar)++-------------------------------------------------------+-- Shared Text+-------------------------------------------------------++indigoTitle :: Text+indigoTitle = "Indigo CLI"++indigoDesc :: Text+indigoDesc = "Indigo CLI provides commands for development and interaction with Indigo project."++indigoRunCommand :: Text+indigoRunCommand = "indigo run"++-------------------------------------------------------+-- Helper+-------------------------------------------------------++type Parser = Parsec Void Text++packageNameParser :: Parser Text+packageNameParser = (toText . intercalate "-")+ <$> sepBy1 word (char '-')+ where+ word = concat <$> sequence [many digitChar,+ fmap pure letterChar,+ many (letterChar <|> digitChar)]++-- | Ensure package name is correct.+-- Base on packageParser from `stack`: https://github.com/commercialhaskell/stack/blob/99ecb78b20072cc8cf8a9f8c5bcd6ed95cd4e122/src/Stack/Types/PackageName.hs+parsePackageName :: Text -> Either Text Text+parsePackageName s =+ case runParser (packageNameParser <* eof) "" s of+ Right a -> Right a+ Left _ -> Left $ unlines+ [ "Expected valid package name, but got: " <> s+ , "Package names consist of one or more alphanumeric words separated by hyphens."+ , "To avoid ambiguity with version numbers, each of these words must contain at least one letter."+ ]++-- | Replace dash with underscore in a word.+-- Mainly use to manipulate package name.+useUnderscore :: Text -> Text+useUnderscore = T.replace "-" "_"
+ app/Main.hs view
@@ -0,0 +1,172 @@+-- SPDX-FileCopyrightText: 2020 Tocqueville Group+--+-- SPDX-License-Identifier: LicenseRef-MIT-TQ++module Main+ ( main+ ) where++import Data.Text (dropWhileEnd)+import qualified Data.Text.IO.Utf8 as Utf8+import Data.Version (showVersion)+import Main.Utf8 (withUtf8)+import Options.Applicative+ (command, execParser, fullDesc, header, help, helper, info, infoOption, long,+ progDesc, subparser)+import qualified Options.Applicative as Opt+import Paths_indigo (version)+import qualified Shelly as S+import Summoner.Question (doesExistProjectName)+import qualified System.Environment as SE+import System.Process++import qualified FileGen+import Helper+import Util.Exception (displayUncaughtException)++data CmdLnArgs+ = New Text+ | Build+ | Run+ | Repl+ | Test++argParser :: Opt.Parser CmdLnArgs+argParser = subparser $+ newSubCmd <>+ buildSubCmd <>+ runSubCmd <>+ replSubCmd <>+ testSubCmd++ where+ mkCommandParser commandName parser desc =+ command commandName $+ info (helper <*> parser) $+ progDesc desc++ newSubCmd =+ mkCommandParser "new"+ (New <$> newArgOption)+ "Create a new project"++ buildSubCmd =+ mkCommandParser "build"+ (pure Build)+ "Build the current project"++ runSubCmd =+ mkCommandParser "run"+ (pure Run)+ "Run the current project"++ replSubCmd =+ mkCommandParser "repl"+ (pure Repl)+ "Access Indigo REPL"++ testSubCmd =+ mkCommandParser "test"+ (pure Test)+ "Run contract tests"++ newArgOption :: Opt.Parser Text+ newArgOption = Opt.strArgument (Opt.metavar "PROJECT NAME")++main :: IO ()+main = displayUncaughtException $ withUtf8 $ do+ r <- isRunCommand+ case r of+ Just input -> do+ handleRunCommand input++ Nothing -> do+ cmdLnArgs <- execParser programInfo+ run cmdLnArgs++ where+ isRunCommand :: IO (Maybe [String])+ isRunCommand = do+ args <- SE.getArgs+ case args of+ "run":input -> pure $ Just input+ _ -> pure Nothing++ -- | Special case for handling @run@ command+ -- Since we want to pass the whole raw input to @ContractRegistry@+ -- it is easy to do it this way, because optparse seems to be not able to+ -- parse raw input.+ handleRunCommand :: [String] -> IO ()+ handleRunCommand input = do+ result <- Utf8.readFile "package.yaml"+ S.shelly . S.escaping False $ case getExecName (words result) of+ Just execName ->+ S.catch_sh @SomeException+ (S.run_ "stack" (["run", execName, "--"] <> (toText <$> input)))+ (const pass) -- Hide Exception error text from `optparse`+ Nothing ->+ die "Could not find executable name in package.yaml"++ programInfo = info (helper <*> versionOption <*> argParser) $+ mconcat+ [ fullDesc+ , progDesc (toString indigoDesc)+ , header (toString indigoTitle)+ ]++ versionOption = infoOption ("indigo-" <> showVersion version)+ (long "version" <> help "Show version.")++ getExecName :: [Text] -> Maybe Text+ getExecName = \case+ "executables:":a:_ -> Just $ dropWhileEnd (==':') a+ _:xs -> getExecName xs+ _ -> Nothing++ getLibName :: [Text] -> Maybe Text+ getLibName = \case+ "name:":a:_ -> Just a+ _ -> Nothing++ run :: CmdLnArgs -> IO ()+ run = \case++ New projName ->+ case parsePackageName projName of+ Right _ -> do+ isNonUnique <- doesExistProjectName projName+ if isNonUnique then+ die "A project with this name already exists. Please choose another one."+ else+ FileGen.run projName++ Left err ->+ die $ toString err++ Build -> S.shelly $ S.escaping False $ do+ S.run_ "stack" ["build", "--fast"]++ -- | Placeholder command+ --+ -- @run@ will be handle by @handleRunCommand@+ -- This is defined only to show the description in @help@ command+ Run -> pure ()++ Repl -> do+ result <- Utf8.readFile "package.yaml"+ target <- case getLibName (words result) of+ Just libName ->+ pure (libName <> ":lib")+ Nothing ->+ -- | Fallback to executable name in case of not finding the library name+ -- Needed especially in running the REPL for the tutorial, since we need the+ -- target to be @:indigo-repl@.+ case getExecName (words result) of+ Just execName -> pure (":" <> execName)+ Nothing ->+ die "Could not find library name in package.yaml"++ S.shelly $ S.liftIO $ callProcess "stack" ["repl", toString target]++ Test -> S.shelly $ S.escaping False $ do+ S.run_ "stack" ["test", "--fast"]
indigo.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: cffb0e9fcbd7e171ecdaea6999a9b146bc06fdac4a338f7db72867769b51c9f8+-- hash: d2d0380bd7fe31c9c13bc66fa1ba8f5589bfb4518b14975a4e15bb0d833ce0d6 name: indigo-version: 0.2.1+version: 0.2.2 synopsis: Convenient imperative eDSL over Lorentz. description: Syntax and implementation of Indigo eDSL. category: Language@@ -79,6 +79,36 @@ , reflection , singletons , vinyl+ , with-utf8+ mixins:+ base hiding (Prelude)+ default-language: Haskell2010++executable indigo+ main-is: Main.hs+ other-modules:+ FileGen+ FileGen.Files+ Helper+ Paths_indigo+ autogen-modules:+ Paths_indigo+ hs-source-dirs:+ app+ default-extensions: AllowAmbiguousTypes ApplicativeDo BangPatterns BlockArguments ConstraintKinds DataKinds DefaultSignatures DeriveAnyClass DeriveDataTypeable DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable DerivingStrategies DerivingVia EmptyCase FlexibleContexts FlexibleInstances GADTs GeneralizedNewtypeDeriving LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NegativeLiterals NumDecimals OverloadedLabels OverloadedStrings PatternSynonyms PolyKinds QuasiQuotes RankNTypes RecordWildCards RecursiveDo ScopedTypeVariables StandaloneDeriving StrictData TemplateHaskell TupleSections TypeApplications TypeFamilies TypeOperators UndecidableInstances UndecidableSuperClasses ViewPatterns+ ghc-options: -Weverything -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-implicit-prelude+ build-depends:+ base >=4.7 && <5+ , directory+ , megaparsec >=7.0.0+ , morley+ , morley-prelude+ , optparse-applicative+ , process+ , shelly+ , string-interpolate+ , summoner+ , text , with-utf8 mixins: base hiding (Prelude)