mirror of
https://github.com/swarm-game/swarm.git
synced 2024-08-16 18:10:23 +03:00
parent
43a5279265
commit
8652440607
4
.github/workflows/haskell-ci.yml
vendored
4
.github/workflows/haskell-ci.yml
vendored
@ -235,8 +235,8 @@ jobs:
|
||||
cabal-docspec $ARG_COMPILER
|
||||
- name: hlint
|
||||
run: |
|
||||
if [ $((HCNUMVER < 90000)) -ne 0 ] ; then (cd ${PKGDIR_swarm} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 -XStrictData src) ; fi
|
||||
if [ $((HCNUMVER < 90000)) -ne 0 ] ; then (cd ${PKGDIR_swarm} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 app) ; fi
|
||||
if [ $((HCNUMVER < 90000)) -ne 0 ] ; then (cd ${PKGDIR_swarm} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 -XBangPatterns -XDeriveAnyClass -XDeriveDataTypeable -XDeriveFunctor -XDeriveGeneric -XDeriveTraversable -XExplicitForAll -XFlexibleContexts -XFlexibleInstances -XGADTSyntax -XMultiParamTypeClasses -XNumericUnderscores -XRankNTypes -XScopedTypeVariables -XStandaloneDeriving -XTupleSections -XTypeApplications -XTypeOperators -XImportQualifiedPost -XLambdaCase -XStrictData src) ; fi
|
||||
if [ $((HCNUMVER < 90000)) -ne 0 ] ; then (cd ${PKGDIR_swarm} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 -XImportQualifiedPost app) ; fi
|
||||
- name: cabal check
|
||||
run: |
|
||||
cd ${PKGDIR_swarm} || false
|
||||
|
@ -10,7 +10,6 @@
|
||||
#
|
||||
# - arguments: [--color, --cpp-simple, -XQuasiQuotes]
|
||||
|
||||
|
||||
# Control which extensions/flags/modules/functions can be used
|
||||
#
|
||||
# - extensions:
|
||||
|
@ -1,3 +1,17 @@
|
||||
restylers_version: dev
|
||||
restylers:
|
||||
- fourmolu
|
||||
- fourmolu:
|
||||
arguments:
|
||||
[ '--ghc-opt=-XBangPatterns'
|
||||
, '--ghc-opt=-XFlexibleContexts'
|
||||
, '--ghc-opt=-XFlexibleInstances'
|
||||
, '--ghc-opt=-XGADTSyntax'
|
||||
, '--ghc-opt=-XMultiParamTypeClasses'
|
||||
, '--ghc-opt=-XNumericUnderscores'
|
||||
, '--ghc-opt=-XRankNTypes'
|
||||
, '--ghc-opt=-XTupleSections'
|
||||
, '--ghc-opt=-XTypeApplications'
|
||||
, '--ghc-opt=-XTypeOperators'
|
||||
, '--ghc-opt=-XImportQualifiedPost'
|
||||
, '--ghc-opt=-XLambdaCase'
|
||||
]
|
||||
|
@ -7,7 +7,7 @@ import Data.Text (
|
||||
Text,
|
||||
pack,
|
||||
)
|
||||
import qualified Data.Text.IO as Text
|
||||
import Data.Text.IO qualified as Text
|
||||
import GitHash
|
||||
import Options.Applicative
|
||||
import Swarm.App (appMain)
|
||||
|
@ -9,7 +9,7 @@ import Control.Monad.Except (runExceptT)
|
||||
import Control.Monad.State (evalStateT, execStateT)
|
||||
import Criterion.Main (Benchmark, bench, bgroup, defaultConfig, defaultMainWith, whnfAppIO)
|
||||
import Criterion.Types (Config (timeLimit))
|
||||
import qualified Data.Functor.Const as F
|
||||
import Data.Functor.Const qualified as F
|
||||
import Data.Int (Int64)
|
||||
import Linear.V2 (V2 (V2))
|
||||
import Swarm.Game.CESK (emptyStore, initMachine)
|
||||
@ -19,7 +19,7 @@ import Swarm.Game.State (GameState, addURobot, classicGame0, creativeMode, world
|
||||
import Swarm.Game.Step (gameTick)
|
||||
import Swarm.Game.Terrain (TerrainType (DirtT))
|
||||
import Swarm.Game.World (newWorld)
|
||||
import qualified Swarm.Language.Context as Context
|
||||
import Swarm.Language.Context qualified as Context
|
||||
import Swarm.Language.Pipeline (ProcessedTerm)
|
||||
import Swarm.Language.Pipeline.QQ (tmQ)
|
||||
import Swarm.Language.Syntax (north)
|
||||
|
@ -1,5 +1,3 @@
|
||||
{-# LANGUAGE NumericUnderscores #-}
|
||||
|
||||
-- |
|
||||
-- Module : Swarm.App
|
||||
-- Copyright : Brent Yorgey
|
||||
@ -14,10 +12,10 @@ import Control.Concurrent (forkIO, threadDelay)
|
||||
|
||||
import Brick
|
||||
import Brick.BChan
|
||||
import qualified Graphics.Vty as V
|
||||
import Graphics.Vty qualified as V
|
||||
|
||||
import Control.Monad.Except
|
||||
import qualified Data.Text.IO as T
|
||||
import Data.Text.IO qualified as T
|
||||
import Swarm.TUI.Attr
|
||||
import Swarm.TUI.Controller
|
||||
import Swarm.TUI.Model
|
||||
|
@ -1,10 +1,4 @@
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE GADTSyntax #-}
|
||||
{-# LANGUAGE ImportQualifiedPost #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
|
||||
module Swarm.DocGen (
|
||||
generateDocs,
|
||||
|
@ -89,7 +89,7 @@ module Swarm.Game.CESK (
|
||||
|
||||
import Control.Lens.Combinators (pattern Empty)
|
||||
import Data.IntMap.Strict (IntMap)
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Data.IntMap.Strict qualified as IM
|
||||
import Data.List (intercalate)
|
||||
import Witch (from)
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
@ -41,7 +39,7 @@ import Brick (AttrName, Widget, str, withAttr)
|
||||
import Control.Lens hiding (Const, from, (.=))
|
||||
import Data.Hashable
|
||||
import Data.Map (Map)
|
||||
import qualified Data.Map as M
|
||||
import Data.Map qualified as M
|
||||
|
||||
import Data.Yaml
|
||||
import GHC.Generics (Generic)
|
||||
|
@ -1,11 +1,4 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
{-# LANGUAGE TypeFamilies #-}
|
||||
|
||||
-- |
|
||||
@ -94,15 +87,15 @@ import Data.Function (on)
|
||||
import Data.Hashable
|
||||
import Data.Int (Int64)
|
||||
import Data.IntMap (IntMap)
|
||||
import qualified Data.IntMap as IM
|
||||
import Data.IntMap qualified as IM
|
||||
import Data.IntSet (IntSet)
|
||||
import qualified Data.IntSet as IS
|
||||
import Data.IntSet qualified as IS
|
||||
import Data.List (foldl')
|
||||
import Data.Map (Map)
|
||||
import qualified Data.Map as M
|
||||
import Data.Map qualified as M
|
||||
import Data.Maybe (fromMaybe, isJust, listToMaybe)
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Data.Text qualified as T
|
||||
import GHC.Generics (Generic)
|
||||
import Linear (V2)
|
||||
import Text.Read (readMaybe)
|
||||
|
@ -1,4 +1,3 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
-- |
|
||||
@ -21,10 +20,10 @@ module Swarm.Game.Exception (
|
||||
|
||||
import Data.Set (Set)
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Data.Text qualified as T
|
||||
|
||||
import Control.Lens ((^.))
|
||||
import qualified Data.Set as S
|
||||
import Data.Set qualified as S
|
||||
import Swarm.Game.Entity (EntityMap, deviceForCap, entityName)
|
||||
import Swarm.Language.Capability (Capability (CGod), capabilityName)
|
||||
import Swarm.Language.Pretty (prettyText)
|
||||
|
@ -1,12 +1,7 @@
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
{-# LANGUAGE DeriveTraversable #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
-- |
|
||||
-- Module : Swarm.Game.Recipe
|
||||
@ -45,11 +40,11 @@ import Control.Lens hiding (from, (.=))
|
||||
import Data.Bifunctor (second)
|
||||
import Data.Either.Validation
|
||||
import Data.IntMap (IntMap)
|
||||
import qualified Data.IntMap as IM
|
||||
import Data.IntMap qualified as IM
|
||||
import Data.List (foldl')
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Data.Text qualified as T
|
||||
import Witch
|
||||
|
||||
import Data.Yaml
|
||||
|
@ -1,10 +1,6 @@
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE StandaloneDeriving #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
{-# LANGUAGE ViewPatterns #-}
|
||||
|
||||
@ -75,7 +71,7 @@ import Data.Hashable (hashWithSalt)
|
||||
import Data.Int (Int64)
|
||||
import Data.Maybe (isNothing)
|
||||
import Data.Sequence (Seq)
|
||||
import qualified Data.Sequence as Seq
|
||||
import Data.Sequence qualified as Seq
|
||||
import Data.Set (Set)
|
||||
import Data.Set.Lens (setOf)
|
||||
import Data.Text (Text)
|
||||
|
@ -1,14 +1,8 @@
|
||||
{-# LANGUAGE DefaultSignatures #-}
|
||||
{-# LANGUAGE DeriveFunctor #-}
|
||||
{-# LANGUAGE DerivingVia #-}
|
||||
{-# LANGUAGE ImportQualifiedPost #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
-- |
|
||||
-- Module : Swarm.Game.Scenario
|
||||
|
@ -1,9 +1,6 @@
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
{-# LANGUAGE ViewPatterns #-}
|
||||
|
||||
-- |
|
||||
@ -93,20 +90,20 @@ import Control.Monad.Except
|
||||
import Data.Array (Array, listArray)
|
||||
import Data.Int (Int64)
|
||||
import Data.IntMap (IntMap)
|
||||
import qualified Data.IntMap as IM
|
||||
import Data.IntMap qualified as IM
|
||||
import Data.IntSet (IntSet)
|
||||
import qualified Data.IntSet as IS
|
||||
import Data.IntSet qualified as IS
|
||||
import Data.IntSet.Lens (setOf)
|
||||
import Data.List (partition)
|
||||
import Data.Map (Map)
|
||||
import qualified Data.Map as M
|
||||
import Data.Map qualified as M
|
||||
import Data.Maybe (fromMaybe)
|
||||
import qualified Data.Set as S
|
||||
import Data.Set qualified as S
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T (lines)
|
||||
import qualified Data.Text.IO as T (readFile)
|
||||
import Data.Text qualified as T (lines)
|
||||
import Data.Text.IO qualified as T (readFile)
|
||||
import Linear
|
||||
import qualified System.Clock
|
||||
import System.Clock qualified
|
||||
import System.Random (StdGen, mkStdGen, randomRIO)
|
||||
import Witch (into)
|
||||
|
||||
@ -121,10 +118,10 @@ import Swarm.Game.Recipe
|
||||
import Swarm.Game.Robot
|
||||
import Swarm.Game.Scenario
|
||||
import Swarm.Game.Value
|
||||
import qualified Swarm.Game.World as W
|
||||
import Swarm.Game.World qualified as W
|
||||
import Swarm.Game.WorldGen (Seed)
|
||||
import Swarm.Language.Capability (constCaps)
|
||||
import qualified Swarm.Language.Context as Ctx
|
||||
import Swarm.Language.Context qualified as Ctx
|
||||
import Swarm.Language.Pipeline (ProcessedTerm)
|
||||
import Swarm.Language.Pipeline.QQ (tmQ)
|
||||
import Swarm.Language.Syntax (Const, Term (TString), allConst)
|
||||
|
@ -1,13 +1,6 @@
|
||||
{-# LANGUAGE BangPatterns #-}
|
||||
{-# LANGUAGE BlockArguments #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
{-# LANGUAGE TypeOperators #-}
|
||||
|
||||
-- |
|
||||
-- Module : Swarm.Game.Step
|
||||
@ -26,21 +19,21 @@ import Data.Array (bounds, (!))
|
||||
import Data.Bool (bool)
|
||||
import Data.Either (partitionEithers, rights)
|
||||
import Data.Foldable (traverse_)
|
||||
import qualified Data.Functor.Const as F
|
||||
import Data.Functor.Const qualified as F
|
||||
import Data.Int (Int64)
|
||||
import qualified Data.IntMap as IM
|
||||
import qualified Data.IntSet as IS
|
||||
import Data.IntMap qualified as IM
|
||||
import Data.IntSet qualified as IS
|
||||
import Data.List (find)
|
||||
import qualified Data.List as L
|
||||
import qualified Data.Map as M
|
||||
import Data.List qualified as L
|
||||
import Data.Map qualified as M
|
||||
import Data.Maybe (fromMaybe, isNothing, listToMaybe, mapMaybe)
|
||||
import qualified Data.Sequence as Seq
|
||||
import qualified Data.Set as S
|
||||
import Data.Sequence qualified as Seq
|
||||
import Data.Set qualified as S
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Data.Text qualified as T
|
||||
import Linear (V2 (..), zero, (^+^))
|
||||
import System.Clock (TimeSpec)
|
||||
import qualified System.Clock
|
||||
import System.Clock qualified
|
||||
import System.Random (UniformRange, uniformR)
|
||||
import Witch (From (from), into)
|
||||
import Prelude hiding (lookup)
|
||||
@ -48,13 +41,13 @@ import Prelude hiding (lookup)
|
||||
import Swarm.Game.CESK
|
||||
import Swarm.Game.Display
|
||||
import Swarm.Game.Entity hiding (empty, lookup, singleton, union)
|
||||
import qualified Swarm.Game.Entity as E
|
||||
import Swarm.Game.Entity qualified as E
|
||||
import Swarm.Game.Exception
|
||||
import Swarm.Game.Recipe
|
||||
import Swarm.Game.Robot
|
||||
import Swarm.Game.State
|
||||
import Swarm.Game.Value
|
||||
import qualified Swarm.Game.World as W
|
||||
import Swarm.Game.World qualified as W
|
||||
import Swarm.Language.Capability
|
||||
import Swarm.Language.Context hiding (delete)
|
||||
import Swarm.Language.Pipeline
|
||||
|
@ -1,6 +1,3 @@
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
-- |
|
||||
-- Module : Swarm.Game.Terrain
|
||||
-- Copyright : Brent Yorgey
|
||||
@ -19,8 +16,8 @@ module Swarm.Game.Terrain (
|
||||
import Brick (Widget)
|
||||
import Data.Aeson (FromJSON (..), withText)
|
||||
import Data.Map (Map, (!))
|
||||
import qualified Data.Map as M
|
||||
import qualified Data.Text as T
|
||||
import Data.Map qualified as M
|
||||
import Data.Text qualified as T
|
||||
import Text.Read (readMaybe)
|
||||
import Witch (into)
|
||||
|
||||
|
@ -20,8 +20,8 @@ module Swarm.Game.Value (
|
||||
|
||||
import Data.Bool (bool)
|
||||
import Data.List (foldl')
|
||||
import qualified Data.Map as M
|
||||
import qualified Data.Set as S
|
||||
import Data.Map qualified as M
|
||||
import Data.Set qualified as S
|
||||
import Data.Set.Lens (setOf)
|
||||
import Data.Text (Text)
|
||||
import Prelude
|
||||
|
@ -1,10 +1,4 @@
|
||||
{-# LANGUAGE AllowAmbiguousTypes #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
{-# LANGUAGE TypeFamilies #-}
|
||||
|
||||
-- |
|
||||
@ -52,13 +46,13 @@ module Swarm.Game.World (
|
||||
|
||||
import Control.Arrow ((&&&))
|
||||
import Control.Lens
|
||||
import qualified Data.Array as A
|
||||
import Data.Array qualified as A
|
||||
import Data.Array.IArray
|
||||
import qualified Data.Array.Unboxed as U
|
||||
import Data.Array.Unboxed qualified as U
|
||||
import Data.Bits
|
||||
import Data.Foldable (foldl')
|
||||
import Data.Int (Int64)
|
||||
import qualified Data.Map.Strict as M
|
||||
import Data.Map.Strict qualified as M
|
||||
import GHC.Generics (Generic)
|
||||
import Linear
|
||||
import Prelude hiding (lookup)
|
||||
|
@ -1,4 +1,3 @@
|
||||
{-# LANGUAGE ImportQualifiedPost #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
-- |
|
||||
|
@ -1,9 +1,3 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveDataTypeable #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
-- |
|
||||
-- Module : Swarm.Language.Capability
|
||||
-- Copyright : Brent Yorgey
|
||||
@ -27,9 +21,9 @@ import Data.Char (toLower)
|
||||
import Data.Hashable (Hashable)
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Set (Set)
|
||||
import qualified Data.Set as S
|
||||
import Data.Set qualified as S
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Data.Text qualified as T
|
||||
import Text.Read (readMaybe)
|
||||
import Witch (from)
|
||||
import Prelude hiding (lookup)
|
||||
|
@ -1,8 +1,5 @@
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
{-# LANGUAGE DeriveDataTypeable #-}
|
||||
{-# LANGUAGE DeriveTraversable #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
|
||||
-- |
|
||||
-- Module : Swarm.Language.Context
|
||||
@ -20,7 +17,7 @@ import Control.Lens.Prism (prism)
|
||||
import Control.Monad.Reader (MonadReader, local)
|
||||
import Data.Data (Data)
|
||||
import Data.Map (Map)
|
||||
import qualified Data.Map as M
|
||||
import Data.Map qualified as M
|
||||
import Data.Text (Text)
|
||||
import Prelude hiding (lookup)
|
||||
|
||||
|
@ -16,14 +16,14 @@ import Control.Monad (void)
|
||||
import Control.Monad.IO.Class
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text.IO as Text
|
||||
import Data.Text.IO qualified as Text
|
||||
import System.IO (stderr)
|
||||
import Witch
|
||||
|
||||
import Language.LSP.Diagnostics
|
||||
import Language.LSP.Server
|
||||
import qualified Language.LSP.Types as J
|
||||
import qualified Language.LSP.Types.Lens as J
|
||||
import Language.LSP.Types qualified as J
|
||||
import Language.LSP.Types.Lens qualified as J
|
||||
import Language.LSP.VFS
|
||||
|
||||
import Swarm.Language.Parse
|
||||
|
@ -1,7 +1,4 @@
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
{-# LANGUAGE TypeFamilies #-}
|
||||
|
||||
-- |
|
||||
@ -41,22 +38,22 @@ module Swarm.Language.Parse (
|
||||
import Control.Monad.Reader
|
||||
import Data.Bifunctor
|
||||
import Data.List (nub)
|
||||
import qualified Data.List.NonEmpty (head)
|
||||
import Data.List.NonEmpty qualified (head)
|
||||
import Data.Maybe (fromMaybe, mapMaybe)
|
||||
import Data.Text (Text, index, toLower)
|
||||
import qualified Data.Text as T
|
||||
import Data.Text qualified as T
|
||||
import Data.Void
|
||||
import Witch
|
||||
|
||||
import Control.Monad.Combinators.Expr
|
||||
import qualified Data.Map.Strict as Map
|
||||
import Data.Map.Strict qualified as Map
|
||||
import Text.Megaparsec hiding (runParser)
|
||||
import Text.Megaparsec.Char
|
||||
import qualified Text.Megaparsec.Char.Lexer as L
|
||||
import qualified Text.Megaparsec.Pos as Pos
|
||||
import Text.Megaparsec.Char.Lexer qualified as L
|
||||
import Text.Megaparsec.Pos qualified as Pos
|
||||
|
||||
import Data.Foldable (asum)
|
||||
import qualified Data.Set as S
|
||||
import Data.Set qualified as S
|
||||
import Data.Set.Lens (setOf)
|
||||
import Swarm.Language.Syntax
|
||||
import Swarm.Language.Types
|
||||
|
@ -9,7 +9,7 @@
|
||||
module Swarm.Language.Parse.QQ (tyQ) where
|
||||
|
||||
import Data.Generics
|
||||
import qualified Language.Haskell.TH as TH
|
||||
import Language.Haskell.TH qualified as TH
|
||||
import Language.Haskell.TH.Quote
|
||||
|
||||
import Swarm.Language.Parse
|
||||
|
@ -1,4 +1,3 @@
|
||||
{-# LANGUAGE DeriveDataTypeable #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
-- |
|
||||
|
@ -9,7 +9,7 @@
|
||||
module Swarm.Language.Pipeline.QQ (tmQ) where
|
||||
|
||||
import Data.Generics
|
||||
import qualified Language.Haskell.TH as TH
|
||||
import Language.Haskell.TH qualified as TH
|
||||
import Language.Haskell.TH.Quote
|
||||
import Witch (from)
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE PatternSynonyms #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
@ -19,10 +18,10 @@ import Data.Bool (bool)
|
||||
import Data.Functor.Fixedpoint (Fix, unFix)
|
||||
import Data.String (fromString)
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Data.Text qualified as T
|
||||
import Prettyprinter
|
||||
import qualified Prettyprinter.Render.String as RS
|
||||
import qualified Prettyprinter.Render.Text as RT
|
||||
import Prettyprinter.Render.String qualified as RS
|
||||
import Prettyprinter.Render.Text qualified as RT
|
||||
import Witch
|
||||
|
||||
import Control.Unification
|
||||
|
@ -1,12 +1,6 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveDataTypeable #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE DerivingStrategies #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE PatternSynonyms #-}
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
-- |
|
||||
@ -73,10 +67,10 @@ module Swarm.Language.Syntax (
|
||||
import Control.Lens (Plated (..), Traversal', (%~))
|
||||
import Data.Data.Lens (uniplate)
|
||||
import Data.Int (Int64)
|
||||
import qualified Data.Map as M
|
||||
import qualified Data.Set as S
|
||||
import Data.Map qualified as M
|
||||
import Data.Set qualified as S
|
||||
import Data.Text hiding (filter, map)
|
||||
import qualified Data.Text as T
|
||||
import Data.Text qualified as T
|
||||
import Linear
|
||||
|
||||
import Data.Aeson.Types
|
||||
|
@ -1,12 +1,5 @@
|
||||
{-# LANGUAGE DeriveFunctor #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE StandaloneDeriving #-}
|
||||
{-# LANGUAGE TypeOperators #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
-- For 'Ord IntVar' instance
|
||||
@ -56,18 +49,18 @@ import Control.Monad.Reader
|
||||
import Data.Foldable (fold)
|
||||
import Data.Functor.Identity
|
||||
import Data.Map (Map)
|
||||
import qualified Data.Map as M
|
||||
import Data.Map qualified as M
|
||||
import Data.Maybe
|
||||
import Data.Set (Set, (\\))
|
||||
import qualified Data.Set as S
|
||||
import Data.Set qualified as S
|
||||
import Prelude hiding (lookup)
|
||||
|
||||
import Control.Unification hiding (applyBindings, (=:=))
|
||||
import qualified Control.Unification as U
|
||||
import Control.Unification qualified as U
|
||||
import Control.Unification.IntVar
|
||||
|
||||
import Swarm.Language.Context hiding (lookup)
|
||||
import qualified Swarm.Language.Context as Ctx
|
||||
import Swarm.Language.Context qualified as Ctx
|
||||
import Swarm.Language.Parse.QQ (tyQ)
|
||||
import Swarm.Language.Syntax
|
||||
import Swarm.Language.Types
|
||||
|
@ -1,13 +1,4 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveDataTypeable #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE DeriveTraversable #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE PatternSynonyms #-}
|
||||
{-# LANGUAGE StandaloneDeriving #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
{-# LANGUAGE TypeFamilies #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -90,10 +81,10 @@ import Data.Foldable (fold)
|
||||
import Data.Functor.Fixedpoint
|
||||
import Data.Maybe (fromJust)
|
||||
import Data.Set (Set)
|
||||
import qualified Data.Set as S
|
||||
import Data.Set qualified as S
|
||||
import Data.String (IsString (..))
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Data.Text qualified as T
|
||||
import GHC.Generics (Generic1)
|
||||
import Witch
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
-- |
|
||||
@ -19,7 +18,7 @@ import Brick
|
||||
import Brick.Forms
|
||||
import Brick.Widgets.Dialog
|
||||
import Brick.Widgets.List
|
||||
import qualified Graphics.Vty as V
|
||||
import Graphics.Vty qualified as V
|
||||
|
||||
import Data.Yaml
|
||||
import Witch (from)
|
||||
|
@ -34,7 +34,7 @@ import Brick
|
||||
import Brick.Widgets.Border
|
||||
import Control.Lens (makeLenses, to, (^.))
|
||||
import Data.Function ((&))
|
||||
import qualified Graphics.Vty as V
|
||||
import Graphics.Vty qualified as V
|
||||
|
||||
-- | Labels for a horizontal border, with optional left, middle, and
|
||||
-- right labels.
|
||||
|
@ -1,7 +1,3 @@
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE ImportQualifiedPost #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE NumericUnderscores #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE PatternSynonyms #-}
|
||||
|
||||
|
@ -14,8 +14,8 @@ import Data.Foldable (toList)
|
||||
import Data.List (find)
|
||||
|
||||
import Brick (EventM)
|
||||
import qualified Brick.Widgets.List as BL
|
||||
import qualified Graphics.Vty as V
|
||||
import Brick.Widgets.List qualified as BL
|
||||
import Graphics.Vty qualified as V
|
||||
|
||||
-- | Handle a list event, taking an extra predicate to identify which
|
||||
-- list elements are separators; separators will be skipped if
|
||||
|
@ -1,10 +1,6 @@
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE ImportQualifiedPost #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
{-# LANGUAGE ViewPatterns #-}
|
||||
|
||||
-- |
|
||||
|
@ -1,7 +1,5 @@
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- |
|
||||
|
@ -1,8 +1,4 @@
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
-- |
|
||||
-- Module : Swarm.TUI.View
|
||||
@ -45,16 +41,16 @@ module Swarm.TUI.View (
|
||||
import Control.Arrow ((&&&))
|
||||
import Control.Lens hiding (Const, from)
|
||||
import Data.Array (range)
|
||||
import qualified Data.Foldable as F
|
||||
import qualified Data.IntMap as IM
|
||||
import qualified Data.List as L
|
||||
import Data.Foldable qualified as F
|
||||
import Data.IntMap qualified as IM
|
||||
import Data.List qualified as L
|
||||
import Data.List.NonEmpty (NonEmpty (..))
|
||||
import Data.List.Split (chunksOf)
|
||||
import qualified Data.Map as M
|
||||
import Data.Map qualified as M
|
||||
import Data.Maybe (fromMaybe, mapMaybe)
|
||||
import Data.String (fromString)
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Data.Text qualified as T
|
||||
import Linear
|
||||
import System.Clock (TimeSpec (..))
|
||||
import Text.Printf
|
||||
@ -67,8 +63,8 @@ import Brick.Forms
|
||||
import Brick.Widgets.Border (hBorder, hBorderWithLabel, joinableBorder, vBorder)
|
||||
import Brick.Widgets.Center (center, centerLayer, hCenter)
|
||||
import Brick.Widgets.Dialog
|
||||
import qualified Brick.Widgets.List as BL
|
||||
import qualified Brick.Widgets.Table as BT
|
||||
import Brick.Widgets.List qualified as BL
|
||||
import Brick.Widgets.Table qualified as BT
|
||||
|
||||
import Swarm.Game.CESK (CESK (..))
|
||||
import Swarm.Game.Display
|
||||
@ -78,7 +74,7 @@ import Swarm.Game.Robot
|
||||
import Swarm.Game.Scenario (ScenarioItem (..), scenarioDescription, scenarioItemName, scenarioName)
|
||||
import Swarm.Game.State
|
||||
import Swarm.Game.Terrain (displayTerrain)
|
||||
import qualified Swarm.Game.World as W
|
||||
import Swarm.Game.World qualified as W
|
||||
import Swarm.Language.Pipeline (ProcessedTerm (..), processParsedTerm)
|
||||
import Swarm.Language.Pretty (prettyText)
|
||||
import Swarm.Language.Syntax
|
||||
|
@ -1,11 +1,5 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE StandaloneDeriving #-}
|
||||
{-# LANGUAGE TemplateHaskellQuotes #-}
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
{-# LANGUAGE TypeOperators #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
-- |
|
||||
@ -74,17 +68,17 @@ import Data.Char (isAlphaNum)
|
||||
import Data.Either.Validation
|
||||
import Data.Int (Int64)
|
||||
import Data.Map (Map)
|
||||
import qualified Data.Map as M
|
||||
import Data.Map qualified as M
|
||||
import Data.Maybe (fromMaybe, mapMaybe)
|
||||
import Data.Text (Text, toUpper)
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text.IO as T
|
||||
import Data.Text qualified as T
|
||||
import Data.Text.IO qualified as T
|
||||
import Data.Tuple (swap)
|
||||
import Data.Yaml
|
||||
import Language.Haskell.TH
|
||||
import Language.Haskell.TH.Syntax (lift)
|
||||
import Linear (V2)
|
||||
import qualified NLP.Minimorph.English as MM
|
||||
import NLP.Minimorph.English qualified as MM
|
||||
import NLP.Minimorph.Util ((<+>))
|
||||
import Paths_swarm (getDataDir)
|
||||
import System.Directory (
|
||||
|
@ -1,9 +1,5 @@
|
||||
{-# LANGUAGE DefaultSignatures #-}
|
||||
{-# LANGUAGE DeriveFunctor #-}
|
||||
{-# LANGUAGE DerivingVia #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
-- |
|
||||
@ -36,7 +32,7 @@ import Data.Aeson.Types (explicitParseField, explicitParseFieldMaybe)
|
||||
import Data.Bifunctor (first)
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Vector as V
|
||||
import Data.Vector qualified as V
|
||||
import Data.Yaml as Y
|
||||
|
||||
------------------------------------------------------------
|
||||
|
41
swarm.cabal
41
swarm.cabal
@ -50,8 +50,35 @@ common stan-config
|
||||
ghc-options: -fwrite-ide-info
|
||||
-hiedir=.hie
|
||||
|
||||
-- Harmless extensions from GHC2021
|
||||
common ghc2021-extensions
|
||||
ghc-options: -Wprepositive-qualified-module
|
||||
default-extensions:
|
||||
BangPatterns
|
||||
DeriveAnyClass
|
||||
DeriveDataTypeable
|
||||
DeriveFunctor
|
||||
DeriveGeneric
|
||||
DeriveTraversable
|
||||
ExplicitForAll
|
||||
FlexibleContexts
|
||||
FlexibleInstances
|
||||
GADTSyntax
|
||||
MultiParamTypeClasses
|
||||
NumericUnderscores
|
||||
RankNTypes
|
||||
ScopedTypeVariables
|
||||
StandaloneDeriving
|
||||
TupleSections
|
||||
TypeApplications
|
||||
TypeOperators
|
||||
-- Note we warn on prequalified
|
||||
ImportQualifiedPost
|
||||
-- Not GHC2021, but until we get \cases we use \case a lot
|
||||
LambdaCase
|
||||
|
||||
library
|
||||
import: stan-config, common
|
||||
import: stan-config, common, ghc2021-extensions
|
||||
exposed-modules: Swarm.Language.Context
|
||||
Swarm.Language.Types
|
||||
Swarm.Language.Syntax
|
||||
@ -130,7 +157,10 @@ library
|
||||
yaml >= 0.11 && < 0.12,
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
default-extensions: StrictData
|
||||
default-extensions:
|
||||
-- Avoid unexpected unevaluated thunk buildup
|
||||
-- See discussion in #415
|
||||
StrictData
|
||||
|
||||
executable swarm
|
||||
import: stan-config, common
|
||||
@ -144,9 +174,10 @@ executable swarm
|
||||
hs-source-dirs: app
|
||||
default-language: Haskell2010
|
||||
ghc-options: -threaded
|
||||
default-extensions: ImportQualifiedPost
|
||||
|
||||
test-suite swarm-unit
|
||||
import: stan-config, common
|
||||
import: stan-config, common, ghc2021-extensions
|
||||
main-is: Main.hs
|
||||
type: exitcode-stdio-1.0
|
||||
|
||||
@ -168,7 +199,7 @@ test-suite swarm-unit
|
||||
ghc-options: -threaded
|
||||
|
||||
test-suite swarm-integration
|
||||
import: stan-config, common
|
||||
import: stan-config, common, ghc2021-extensions
|
||||
main-is: Main.hs
|
||||
type: exitcode-stdio-1.0
|
||||
|
||||
@ -193,7 +224,7 @@ test-suite swarm-integration
|
||||
ghc-options: -threaded
|
||||
|
||||
benchmark benchmark
|
||||
import: stan-config, common
|
||||
import: stan-config, common, ghc2021-extensions
|
||||
main-is: Benchmark.hs
|
||||
hs-source-dirs: bench
|
||||
type: exitcode-stdio-1.0
|
||||
|
@ -11,11 +11,11 @@ import Control.Monad.State (StateT (runStateT), gets)
|
||||
import Control.Monad.Trans.Except (runExceptT)
|
||||
import Data.Containers.ListUtils (nubOrd)
|
||||
import Data.Foldable (Foldable (toList), find)
|
||||
import qualified Data.IntSet as IS
|
||||
import qualified Data.Map as M
|
||||
import Data.IntSet qualified as IS
|
||||
import Data.Map qualified as M
|
||||
import Data.Maybe (isJust)
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Data.Text qualified as T
|
||||
import Data.Yaml (ParseException, prettyPrintParseException)
|
||||
import Swarm.Game.CESK (emptyStore, initMachine)
|
||||
import Swarm.Game.Entity (EntityMap, loadEntities)
|
||||
@ -33,7 +33,7 @@ import Swarm.Game.State (
|
||||
winSolution,
|
||||
)
|
||||
import Swarm.Game.Step (gameTick)
|
||||
import qualified Swarm.Language.Context as Ctx
|
||||
import Swarm.Language.Context qualified as Ctx
|
||||
import Swarm.Language.Pipeline (processTerm)
|
||||
import Swarm.Util.Yaml (decodeFileEitherE)
|
||||
import System.Directory (doesDirectoryExist, doesFileExist, listDirectory)
|
||||
|
@ -1,5 +1,4 @@
|
||||
{-# LANGUAGE BangPatterns #-}
|
||||
{-# LANGUAGE ImportQualifiedPost #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user