1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 16:02:43 +03:00

Merge pull request #400 from github/glorious-ghc-upgrade-8.8

Upgrade to GHC 8.8 and Actions CI.
This commit is contained in:
Patrick Thomson 2019-12-17 11:53:21 -05:00 committed by GitHub
commit 1d7ddcc36e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 178 additions and 200 deletions

58
.github/workflows/haskell.yml vendored Normal file
View File

@ -0,0 +1,58 @@
name: Haskell CI
on: [pull_request]
jobs:
build:
name: ghc ${{ matrix.ghc }}
runs-on: ubuntu-16.04
strategy:
matrix:
ghc: ["8.8.1"]
cabal: ["3.0"]
steps:
- uses: actions/checkout@master
if: github.event.action == 'opened' || github.event.action == 'synchronize'
- uses: actions/setup-haskell@v1
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- uses: actions/cache@preview
name: Cache ~/.cabal/packages
with:
path: ~/.cabal/packages
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-packages
- uses: actions/cache@preview
name: Cache ~/.cabal/store
with:
path: ~/.cabal/store
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-store
- uses: actions/cache@preview
name: Cache dist-newstyle
with:
path: dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}-semantic-dist
- name: Install dependencies
run: |
cabal v2-update
cabal v2-configure --disable-optimization --enable-benchmarks --enable-tests --write-ghc-environment-files=always -j2
cabal v2-build --only-dependencies
- name: hlint
run: |
cabal install hlint --installdir=dist-newstyle
dist-newstyle/hlint src semantic-python
- name: Build & test
run: |
cabal v2-build
cabal v2-run semantic:test
cabal v2-run semantic-core:test
cabal v2-run semantic-python:test
cd semantic-source; cabal v2-run semantic-source:test; cd ..
cd semantic-source; cabal v2-run semantic-source:doctest -- src; cd ..

View File

@ -1,56 +0,0 @@
language: c
cache:
directories:
- $HOME/.cabal/packages
- $HOME/.cabal/store
- $TRAVIS_BUILD_DIR/dist-newstyle
before_cache:
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
# remove files that are regenerated by 'cabal update'
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
- rm -rfv $HOME/.cabal/packages/head.hackage
matrix:
include:
- compiler: "ghc-8.6.5"
addons: {apt: {packages: [cabal-install-2.4,ghc-8.6.5], sources: [hvr-ghc]}}
before_install:
- mkdir -p $HOME/.local/bin
- curl -L -o /tmp/hlint.tar.gz "https://github.com/ndmitchell/hlint/releases/download/v2.2.3/hlint-2.2.3-x86_64-linux.tar.gz"
- tar -xf /tmp/hlint.tar.gz -C /tmp
- cp /tmp/hlint-2.2.3/hlint $HOME/.local/bin
- cp -r /tmp/hlint-2.2.3/data $HOME/.local/bin
- "PATH=/opt/ghc/bin:$HOME/local/bin:$PATH"
- ghc --version
- cabal --version
- hlint --version
install:
- cabal v2-update -v
- cabal v2-configure --enable-tests --enable-benchmarks --disable-optimization --write-ghc-environment-files=always --jobs=2
- cabal v2-build --only-dependencies
script:
- hlint src semantic-python
- cabal v2-build
- cabal v2-run semantic:test
- cabal v2-run semantic-core:test
- cabal v2-run semantic-python:test
- cd semantic-source; cabal v2-run semantic-source:test; cd ..
- cd semantic-source; cabal v2-run semantic-source:doctest; cd ..
# parse-examples is disabled because it slaughters our CI
# - cabal v2-run semantic:parse-examples
# Any branch linked with a pull request will be built, as well as the non-PR
# branches listed below:
branches:
only:
- master

View File

@ -1,5 +1,5 @@
# Put protoc and twirp tooling in its own image
FROM haskell:8.6 as haskell
FROM haskell:8.8 as haskell
RUN cabal v2-update && \
cabal v2-install proto-lens-protoc
RUN which proto-lens-protoc
@ -19,7 +19,7 @@ COPY --from=haskell /root/.cabal/bin/proto-lens-protoc /usr/local/bin/proto-lens
ENTRYPOINT ["/protobuf/bin/protoc", "-I/protobuf", "--plugin=protoc-gen-haskell=/usr/local/bin/proto-lens-protoc"]
# Build semantic
FROM haskell:8.6 as build
FROM haskell:8.8 as build
WORKDIR /build
# Build all of semantic

View File

@ -96,7 +96,7 @@ Available options:
## Development
`semantic` requires at least GHC 8.6.4 and Cabal 2.4. We strongly recommend using [`ghcup`][ghcup] to sandbox GHC versions, as GHC packages installed through your OS's package manager may not install statically-linked versions of the GHC boot libraries. `semantic` currently builds only on Unix systems; users of other operating systems may wish to use the [Docker images](https://github.com/github/semantic/packages/11609).
`semantic` requires at least GHC 8.8.1 and Cabal 3.0. We strongly recommend using [`ghcup`][ghcup] to sandbox GHC versions, as GHC packages installed through your OS's package manager may not install statically-linked versions of the GHC boot libraries. `semantic` currently builds only on Unix systems; users of other operating systems may wish to use the [Docker images](https://github.com/github/semantic/packages/11609).
We use `cabal's` [Nix-style local builds][nix] for development. To get started quickly:

View File

@ -36,7 +36,7 @@ package semantic-ast
source-repository-package
type: git
location: https://github.com/tclem/proto-lens-jsonpb
tag: e4d10b77f57ee25beb759a33e63e2061420d3dc2
tag: 5d40444be689bef1e12cbe38da0261283775ec64
source-repository-package
type: git

View File

@ -52,13 +52,13 @@ library
Control.Effect.Readline
build-depends:
algebraic-graphs ^>= 0.3
, base >= 4.12 && < 5
, base >= 4.13 && < 5
, containers ^>= 0.6
, fused-effects ^>= 1.0
, fused-syntax
, haskeline ^>= 0.7.5
, pathtype ^>= 0.8.1
, prettyprinter ^>= 1.2.1
, prettyprinter >= 1.2.1 && < 1.4
, prettyprinter-ansi-terminal ^>= 1.1.1
, semantic-source ^>= 0
, terminal-size ^>= 0.3

View File

@ -1,4 +1,6 @@
{-# LANGUAGE DerivingVia, FlexibleContexts, FlexibleInstances, LambdaCase, MultiParamTypeClasses, NamedFieldPuns, OverloadedStrings, RankNTypes, RecordWildCards, ScopedTypeVariables, TypeApplications, TypeOperators, UndecidableInstances #-}
{-# LANGUAGE DerivingVia, FlexibleContexts, FlexibleInstances, LambdaCase, MultiParamTypeClasses, NamedFieldPuns,
OverloadedStrings, RankNTypes, RecordWildCards, ScopedTypeVariables, TypeApplications, TypeOperators,
UndecidableInstances #-}
module Analysis.Concrete
( Concrete(..)
, concrete
@ -14,13 +16,12 @@ import qualified Algebra.Graph.Export.Dot as G
import Analysis.Analysis
import Analysis.File
import Control.Algebra
import Control.Applicative (Alternative (..))
import Control.Carrier.Fail.WithLoc
import Control.Carrier.Fresh.Strict
import Control.Carrier.NonDet.Church
import Control.Carrier.Reader hiding (Local)
import Control.Carrier.State.Strict
import Control.Monad ((<=<), guard)
import Control.Monad ((<=<))
import Data.Function (fix)
import qualified Data.IntMap as IntMap
import qualified Data.IntSet as IntSet

View File

@ -40,12 +40,12 @@ library
exposed-modules:
-- other-modules:
-- other-extensions:
build-depends: base ^>=4.12.0.0
build-depends: base ^>= 4.13
, tree-sitter ^>= 0.7.1
, semantic-source ^>= 0.0
, tree-sitter-python ^>= 0.8
, bytestring ^>= 0.10.8.2
, optparse-applicative ^>= 0.14.3.0
, optparse-applicative >= 0.14.3 && < 0.16
, pretty-simple ^>= 3.1.0.0
hs-source-dirs: src
default-language: Haskell2010
@ -55,13 +55,13 @@ executable semantic-ast
main-is: Main.hs
-- other-modules:
-- other-extensions:
build-depends: base ^>=4.12.0.0
build-depends: base
, semantic-ast
, tree-sitter ^>= 0.7
, semantic-source ^>= 0.0
, tree-sitter-python ^>= 0.8
, bytestring ^>= 0.10.8.2
, optparse-applicative ^>= 0.14.3.0
, pretty-simple ^>= 3.1.0.0
, tree-sitter
, semantic-source
, tree-sitter-python
, bytestring
, optparse-applicative
, pretty-simple
hs-source-dirs: src
default-language: Haskell2010

View File

@ -46,17 +46,17 @@ library
Core.Eval
Core.Name
build-depends:
base >= 4.12 && < 5
base >= 4.13 && < 5
, fused-effects ^>= 1.0
, fused-syntax
, parsers ^>= 0.12.10
, pathtype ^>= 0.8.1
, prettyprinter ^>= 1.2.1
, prettyprinter >= 1.2.1 && < 1.4
, prettyprinter-ansi-terminal ^>= 1.1.1
, semantic-analysis ^>= 0
, semantic-source ^>= 0
, text ^>= 1.2.3.1
, trifecta ^>= 2
, trifecta >= 2 && < 2.2
, unordered-containers ^>= 0.2.10
test-suite test

View File

@ -23,7 +23,7 @@ library
Language.Java
Language.Java.Tags
build-depends:
base >= 4.12 && < 5
base >= 4.13 && < 5
, fused-effects ^>= 1.0
, semantic-source ^>= 0.0
, semantic-tags ^>= 0.0

View File

@ -22,7 +22,7 @@ library
exposed-modules:
Language.JSON
build-depends:
base >= 4.12 && < 5
base >= 4.13 && < 5
, semantic-tags ^>= 0.0
, tree-sitter ^>= 0.7
, tree-sitter-json ^>= 0.5

View File

@ -20,7 +20,7 @@ tested-with: GHC == 8.6.5
common haskell
default-language: Haskell2010
build-depends: base ^>=4.12
build-depends: base ^>= 4.13
, fused-effects ^>= 1.0
, fused-syntax
, parsers ^>= 0.12.10
@ -43,7 +43,8 @@ common haskell
-Wno-missed-specialisations
-Wno-all-missed-specialisations
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
library

View File

@ -48,7 +48,7 @@ library
Source.Span
build-depends:
aeson ^>= 1.4.2.0
, base >= 4.12 && < 5
, base >= 4.13 && < 5
, bytestring ^>= 0.10.8.2
, deepseq ^>= 1.4.4.0
, generic-monoid ^>= 0.1.0.0

View File

@ -24,7 +24,7 @@ library
Tags.Tag
Tags.Tagging.Precise
build-depends:
base >= 4.12 && < 5
base >= 4.13 && < 5
, fused-effects ^>= 1.0
, semantic-source ^>= 0.0
, text ^>= 1.2.3.1
@ -42,3 +42,5 @@ library
-Wno-missed-specialisations
-Wno-all-missed-specialisations
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies

View File

@ -16,7 +16,7 @@ build-type: Simple
stability: alpha
extra-source-files: README.md
tested-with: GHC == 8.6.5
tested-with: GHC == 8.8.1
flag release
description: Build with optimizations on (for CI or deployment builds)
@ -46,7 +46,7 @@ common haskell
-- as caret-operator bounds relative to a version in Stackage.
-- These are currently pinned to lts-13.13.
common dependencies
build-depends: base >= 4.12 && < 5
build-depends: base >= 4.13 && < 5
, aeson ^>= 1.4.2.0
, algebraic-graphs ^>= 0.3
, async ^>= 2.2.1
@ -54,11 +54,11 @@ common dependencies
, bytestring ^>= 0.10.8.2
, containers ^>= 0.6.0.1
, directory ^>= 1.3.3.0
, fastsum ^>= 0.1.1.0
, fastsum ^>= 0.1.1.1
, fused-effects ^>= 1
, fused-effects-exceptions ^>= 1
, fused-effects-resumable ^>= 0.1
, hashable ^>= 1.2.7.0
, hashable >= 1.2.7 && < 1.4
, tree-sitter ^>= 0.7.1
, mtl ^>= 2.2.2
, network ^>= 2.8.0.0
@ -257,7 +257,7 @@ library
, Prologue
autogen-modules: Paths_semantic
other-modules: Paths_semantic
build-depends: base >= 4.12 && < 5
build-depends: base >= 4.13 && < 5
, ansi-terminal >= 0.8.2 && <1
, array ^>= 0.5.3.0
, attoparsec ^>= 0.13.2.2
@ -272,18 +272,18 @@ library
, hostname ^>= 1.0
, hscolour ^>= 1.24.4
, kdt ^>= 0.2.4
, lens ^>= 4.17
, lens >= 4.17 && < 4.19
, mersenne-random-pure64 ^>= 0.2.2.0
, network-uri ^>= 2.6.1.0
, optparse-applicative ^>= 0.14.3.0
, optparse-applicative >= 0.14.3 && < 0.16
, parallel ^>= 3.2.2.0
, parsers ^>= 0.12.9
, prettyprinter ^>= 1.2.1
, prettyprinter >= 1.2.1 && < 1.4
, pretty-show ^>= 1.9.5
, profunctors ^>= 5.3
, proto-lens ^>= 0.5.1.0
, proto-lens >= 0.5 && < 0.7
, proto-lens-jsonpb
, proto-lens-runtime ^>= 0.5.0.0
, proto-lens-runtime >= 0.5 && <0.7
, reducers ^>= 3.12.3
, semantic-java ^>= 0
, semantic-json ^>= 0
@ -292,8 +292,8 @@ library
, semigroupoids ^>= 5.3.2
, split ^>= 0.2.3.3
, stm-chans ^>= 3.0.0.4
, template-haskell ^>= 2.14
, time ^>= 1.8.0.2
, template-haskell >= 2.14 && < 2.16
, time >= 1.8.0.2 && < 1.10
, utf8-string ^>= 1.0.1.1
, unliftio-core ^>= 0.1.2.0
, unordered-containers ^>= 0.2.9.0

View File

@ -24,7 +24,6 @@ import Control.Carrier.State.Strict
import Control.Effect.Sum.Project
import Data.Abstract.BaseError
import Data.Abstract.Module (Module (moduleInfo), ModuleInfo (..))
import Data.Abstract.Package (PackageInfo (..))
import Data.ByteString.Builder
import Data.Graph
import Data.Graph.ControlFlowVertex

View File

@ -98,7 +98,6 @@ import Data.AST
import Data.Error
import qualified Source.Source as Source
import Data.Term
import Data.Text (Text)
import Data.Text.Encoding (decodeUtf8')
import qualified Source.Loc as L
import Source.Range as Range

View File

@ -1,4 +1,6 @@
{-# LANGUAGE DeriveFunctor, DeriveGeneric, FlexibleContexts, GADTs, GeneralizedNewtypeDeriving, KindSignatures, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TypeOperators, UndecidableInstances #-}
{-# LANGUAGE DeriveFunctor, DeriveGeneric, FlexibleContexts, GADTs, GeneralizedNewtypeDeriving, KindSignatures,
RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TypeOperators,
UndecidableInstances #-}
module Control.Abstract.Heap
( Heap
, HeapError(..)
@ -48,17 +50,16 @@ import Control.Abstract.Roots
import Control.Abstract.ScopeGraph hiding (ScopeError (..))
import Control.Abstract.ScopeGraph (ScopeError)
import Control.Algebra
import Control.Applicative (Alternative)
import qualified Control.Carrier.Resumable.Resume as With
import Control.Carrier.Resumable.Either (SomeError (..))
import qualified Control.Carrier.Resumable.Either as Either
import qualified Control.Carrier.Resumable.Resume as With
import Data.Abstract.BaseError
import Data.Abstract.Heap (Heap, Position (..))
import qualified Data.Abstract.Heap as Heap
import Data.Abstract.Live
import Data.Abstract.Module (ModuleInfo)
import Data.Abstract.Name
import Data.Abstract.ScopeGraph (Kind(..), Path (..), Relation(..), putDeclarationScopeAtPosition)
import Data.Abstract.ScopeGraph (Kind (..), Path (..), putDeclarationScopeAtPosition)
import qualified Data.Map.Strict as Map
import Prologue
import Source.Span (Span)
@ -464,7 +465,7 @@ instance Show address => Show1 (AddressError address value) where
instance Eq address => Eq1 (AddressError address value) where
liftEq _ (UninitializedSlot a) (UninitializedSlot b) = a == b
liftEq _ (UnallocatedSlot a) (UnallocatedSlot b) = a == b
liftEq _ _ _ = False
liftEq _ _ _ = False
throwAddressError :: ( Has (Resumable (BaseError (AddressError address body))) sig m
, Has (Reader ModuleInfo) sig m

View File

@ -1,4 +1,5 @@
{-# LANGUAGE DeriveFunctor, DeriveGeneric, FlexibleContexts, GADTs, GeneralizedNewtypeDeriving, KindSignatures, MultiParamTypeClasses, RankNTypes, ScopedTypeVariables, TypeOperators #-}
{-# LANGUAGE DeriveFunctor, DeriveGeneric, FlexibleContexts, GADTs, GeneralizedNewtypeDeriving, KindSignatures,
MultiParamTypeClasses, RankNTypes, ScopedTypeVariables, TypeOperators #-}
module Control.Abstract.Value
( AbstractValue(..)
, AbstractIntro(..)
@ -73,7 +74,7 @@ module Control.Abstract.Value
import Control.Abstract.Evaluator
import Control.Abstract.Heap
import Control.Abstract.ScopeGraph (Allocator, CurrentScope, Declaration, ScopeGraph)
import Control.Abstract.ScopeGraph (CurrentScope, Declaration, ScopeGraph)
import Control.Algebra
import Control.Carrier.Reader
import Data.Abstract.BaseError

View File

@ -32,7 +32,7 @@ import Semantic.Timeout
import Source.Source (Source)
newtype ParseC m a = ParseC { runParse :: m a }
deriving (Applicative, Functor, Monad, MonadIO)
deriving (Applicative, Functor, Monad, MonadFail, MonadIO)
instance ( Has (Error SomeException) sig m
, Has (Reader TaskSession) sig m

View File

@ -1,4 +1,5 @@
{-# LANGUAGE FlexibleContexts, FlexibleInstances, GADTs, GeneralizedNewtypeDeriving, MultiParamTypeClasses, RecordWildCards, TypeOperators, UndecidableInstances #-}
{-# LANGUAGE FlexibleContexts, FlexibleInstances, GADTs, GeneralizedNewtypeDeriving, MultiParamTypeClasses,
RecordWildCards, TypeOperators, UndecidableInstances #-}
-- | A carrier for 'Parse' effects suitable for use in the repl, tests, etc.
module Control.Carrier.Parse.Simple
( -- * Parse carrier
@ -26,14 +27,14 @@ runParse :: Duration -> ParseC m a -> m a
runParse timeout (ParseC m) = runReader timeout m
newtype ParseC m a = ParseC (ReaderC Duration m a)
deriving (Applicative, Functor, Monad, MonadIO)
deriving (Applicative, Functor, Monad, MonadFail, MonadIO)
instance ( Has (Error SomeException) sig m
, MonadIO m
)
=> Algebra (Parse :+: sig) (ParseC m) where
alg (L (Parse parser blob k)) = ParseC ask >>= \ timeout -> runParser timeout blob parser >>= k
alg (R other) = ParseC (send (handleCoercible other))
alg (R other) = ParseC (send (handleCoercible other))
-- | Parse a 'Blob' in 'IO'.
runParser

View File

@ -3,11 +3,10 @@ module Data.Abstract.Address.Precise
( Precise(..)
) where
import Control.Abstract
import Control.Abstract.ScopeGraph (AllocatorC(..))
import Control.Algebra
import Control.Abstract
import Control.Algebra
import qualified Data.Set as Set
import Prologue
import Prologue
-- | 'Precise' models precise store semantics where only the 'Latest' value is taken. Everything gets it's own address (always makes a new allocation) which makes for a larger store.
newtype Precise = Precise { unPrecise :: Int }
@ -18,7 +17,7 @@ instance Show Precise where
instance Has Fresh sig m => Algebra (Allocator Precise :+: sig) (AllocatorC Precise m) where
alg (R other) = AllocatorC . alg . handleCoercible $ other
alg (R other) = AllocatorC . alg . handleCoercible $ other
alg (L (Alloc _ k)) = Precise <$> fresh >>= k

View File

@ -38,7 +38,6 @@ import Data.Abstract.FreeVariables as X
import Data.Abstract.Module
import Data.Abstract.Name as X
import qualified Data.Abstract.ScopeGraph as ScopeGraph
import Data.Abstract.ScopeGraph (Relation(..))
import Data.Abstract.AccessControls.Class as X
import Data.Language
import Data.Semigroup.App

View File

@ -12,7 +12,6 @@ module Data.Abstract.Name
import Control.Effect.Fresh
import Data.Aeson
import qualified Data.Char as Char
import Data.Text (Text)
import qualified Data.Text as Text
import Prologue

View File

@ -1,4 +1,5 @@
{-# LANGUAGE FlexibleContexts, FlexibleInstances, GADTs, LambdaCase, MultiParamTypeClasses, RankNTypes, ScopedTypeVariables, StandaloneDeriving, TypeApplications, TypeOperators, UndecidableInstances #-}
{-# LANGUAGE FlexibleContexts, FlexibleInstances, GADTs, LambdaCase, MultiParamTypeClasses, RankNTypes,
ScopedTypeVariables, StandaloneDeriving, TypeApplications, TypeOperators, UndecidableInstances #-}
module Data.Abstract.Value.Concrete
( Value (..)
, ValueError (..)
@ -8,25 +9,23 @@ module Data.Abstract.Value.Concrete
import Prologue
import Control.Carrier.Resumable.Either (SomeError)
import Control.Carrier.Resumable.Either (SomeError)
import qualified Control.Carrier.Resumable.Either as Either
import qualified Control.Carrier.Resumable.Resume as With
import Data.List (genericIndex, genericLength)
import Data.List (genericIndex, genericLength)
import qualified Data.Map.Strict as Map
import Data.Scientific (Scientific, coefficient, normalize)
import Data.Scientific.Exts
import Data.Text (pack)
import Data.Scientific.Exts
import Data.Text (pack)
import Control.Abstract.ScopeGraph (Allocator, ScopeError)
import Control.Abstract.Heap (scopeLookup)
import Control.Abstract hiding
(Array (..), Boolean (..), Function (..), Hash (..), Numeric (..), Object (..), String (..), Unit (..), While (..))
import qualified Control.Abstract as Abstract
import Control.Abstract hiding (Boolean(..), Function(..), Numeric(..), Object(..), Array(..), Hash(..), String(..), Unit(..), While(..))
import Control.Algebra
import Control.Effect.Interpose
import Data.Abstract.BaseError
import Data.Abstract.Evaluatable (UnspecializedError(..), EvalError(..), Declarations)
import Data.Abstract.FreeVariables
import Data.Abstract.Name
import Control.Algebra
import Control.Effect.Interpose
import Data.Abstract.BaseError
import Data.Abstract.Evaluatable (Declarations, EvalError (..), UnspecializedError (..))
import Data.Abstract.FreeVariables
import Data.Abstract.Name
import qualified Data.Abstract.Number as Number
@ -200,7 +199,7 @@ instance ( Algebra sig m
instance Algebra sig m
=> Algebra (Abstract.Unit (Value term address) :+: sig) (UnitC (Value term address) m) where
alg (R other) = UnitC . alg . handleCoercible $ other
alg (R other) = UnitC . alg . handleCoercible $ other
alg (L (Abstract.Unit k )) = k Unit
instance ( Has (Reader ModuleInfo) sig m
@ -252,7 +251,7 @@ specialize :: ( Has (Reader ModuleInfo) sig m
)
=> Either ArithException Number.SomeNumber
-> m (Value term address)
specialize (Left exc) = throwBaseError (ArithmeticError exc)
specialize (Left exc) = throwBaseError (ArithmeticError exc)
specialize (Right (Number.SomeNumber (Number.Integer t))) = pure (Integer (Number.Integer t))
specialize (Right (Number.SomeNumber (Number.Decimal t))) = pure (Float (Number.Decimal t))
specialize (Right (Number.SomeNumber (Number.Ratio t))) = pure (Rational (Number.Ratio t))
@ -284,12 +283,12 @@ ourShift a b = toInteger (shiftR a b)
instance Algebra sig m => Algebra (Abstract.Object address (Value term address) :+: sig) (ObjectC address (Value term address) m) where
alg (R other) = ObjectC . alg . handleCoercible $ other
alg (L op) = case op of
Abstract.Object address k -> k (Object address)
Abstract.ScopedEnvironment (Object address) k -> k (Just address)
Abstract.ScopedEnvironment (Class _ _ address) k -> k (Just address)
Abstract.Object address k -> k (Object address)
Abstract.ScopedEnvironment (Object address) k -> k (Just address)
Abstract.ScopedEnvironment (Class _ _ address) k -> k (Just address)
Abstract.ScopedEnvironment (Namespace _ address) k -> k (Just address)
Abstract.ScopedEnvironment _ k -> k Nothing
Abstract.Klass n frame k -> k (Class n mempty frame)
Abstract.ScopedEnvironment _ k -> k Nothing
Abstract.Klass n frame k -> k (Class n mempty frame)
instance ( Has (Reader ModuleInfo) sig m
, Has (Reader Span) sig m
@ -300,14 +299,14 @@ instance ( Has (Reader ModuleInfo) sig m
=> Algebra (Abstract.Array (Value term address) :+: sig) (ArrayC (Value term address) m) where
alg (R other) = ArrayC . alg . handleCoercible $ other
alg (L op) = case op of
Abstract.Array t k -> k (Array t)
Abstract.Array t k -> k (Array t)
Abstract.AsArray (Array addresses) k -> k addresses
Abstract.AsArray val k -> throwBaseError (ArrayError val) >>= k
Abstract.AsArray val k -> throwBaseError (ArrayError val) >>= k
instance ( Algebra sig m ) => Algebra (Abstract.Hash (Value term address) :+: sig) (HashC (Value term address) m) where
alg (R other) = HashC . alg . handleCoercible $ other
alg (L op) = case op of
Abstract.Hash t k -> k ((Hash . map (uncurry KVPair)) t)
Abstract.Hash t k -> k ((Hash . map (uncurry KVPair)) t)
Abstract.KvPair t v k -> k (KVPair t v)
@ -386,17 +385,17 @@ data ValueError term address resume where
BoundsError :: [Value term address] -> Prelude.Integer -> ValueError term address (Value term address)
instance (Eq address, Eq term) => Eq1 (ValueError term address) where
liftEq _ (StringError a) (StringError b) = a == b
liftEq _ (CallError a) (CallError b) = a == b
liftEq _ (BoolError a) (BoolError c) = a == c
liftEq _ (IndexError a b) (IndexError c d) = (a == c) && (b == d)
liftEq _ (Numeric2Error a b) (Numeric2Error c d) = (a == c) && (b == d)
liftEq _ (ComparisonError a b) (ComparisonError c d) = (a == c) && (b == d)
liftEq _ (Bitwise2Error a b) (Bitwise2Error c d) = (a == c) && (b == d)
liftEq _ (BitwiseError a) (BitwiseError b) = a == b
liftEq _ (KeyValueError a) (KeyValueError b) = a == b
liftEq _ (BoundsError a b) (BoundsError c d) = (a == c) && (b == d)
liftEq _ _ _ = False
liftEq _ (StringError a) (StringError b) = a == b
liftEq _ (CallError a) (CallError b) = a == b
liftEq _ (BoolError a) (BoolError c) = a == c
liftEq _ (IndexError a b) (IndexError c d) = (a == c) && (b == d)
liftEq _ (Numeric2Error a b) (Numeric2Error c d) = (a == c) && (b == d)
liftEq _ (ComparisonError a b) (ComparisonError c d) = (a == c) && (b == d)
liftEq _ (Bitwise2Error a b) (Bitwise2Error c d) = (a == c) && (b == d)
liftEq _ (BitwiseError a) (BitwiseError b) = a == b
liftEq _ (KeyValueError a) (KeyValueError b) = a == b
liftEq _ (BoundsError a b) (BoundsError c d) = (a == c) && (b == d)
liftEq _ _ _ = False
deriving instance (Show address, Show term) => Show (ValueError term address resume)
instance (Show address, Show term) => Show1 (ValueError term address) where

View File

@ -25,10 +25,10 @@ readBlobFromFile (File path language) = do
pure . Just . sourceBlob path language . Source.fromUTF8 $ raw
-- | Read a utf8-encoded file to a 'Blob', raising an IOError if it can't be found.
readBlobFromFile' :: MonadIO m => File -> m Blob
readBlobFromFile' :: (MonadFail m, MonadIO m) => File -> m Blob
readBlobFromFile' file = do
maybeFile <- readBlobFromFile file
maybeM (Prelude.fail ("cannot read '" <> show file <> "', file not found or language not supported.")) maybeFile
maybeM (fail ("cannot read '" <> show file <> "', file not found or language not supported.")) maybeFile
-- | Read all blobs in the directory with Language.supportedExts.
readBlobsFromDir :: MonadIO m => Path.AbsRelDir -> m [Blob]

View File

@ -14,7 +14,6 @@ module Data.Error
import Prologue
import Data.ByteString.Char8 (unpack)
import Data.Ix (inRange)
import Data.List (intersperse, isSuffixOf)
import System.Console.ANSI

View File

@ -20,7 +20,6 @@ import Data.Abstract.Name
import Data.Abstract.Package (PackageInfo (..))
import Data.Aeson
import Data.Graph (VertexTag (..))
import qualified Data.Graph as G
import Data.Quieterm (Quieterm(..))
import qualified Data.Syntax as Syntax
import qualified Data.Syntax.Declaration as Declaration

View File

@ -1,4 +1,5 @@
{-# LANGUAGE DefaultSignatures, FlexibleContexts, FlexibleInstances, GADTs, MultiParamTypeClasses, OverloadedStrings, RecordWildCards, TypeApplications, TypeOperators, UndecidableInstances #-}
{-# LANGUAGE DefaultSignatures, FlexibleContexts, FlexibleInstances, GADTs, MultiParamTypeClasses, OverloadedStrings,
RecordWildCards, TypeApplications, TypeOperators, UndecidableInstances #-}
module Data.JSON.Fields
( JSONFields (..)
, JSONFields1 (..)
@ -10,7 +11,6 @@ module Data.JSON.Fields
import Data.Aeson
import Data.Edit
import qualified Data.Map as Map
import Data.Sum (Apply (..), Sum)
import qualified Data.Text as Text
import GHC.Generics
import Prologue

View File

@ -9,7 +9,6 @@ import qualified Data.Set as Set
import Control.Abstract hiding (AccessControl (..), Function)
import Data.Abstract.Evaluatable
import Data.Abstract.Name (__self)
import qualified Data.Abstract.ScopeGraph as ScopeGraph
import Data.JSON.Fields
import Diffing.Algorithm

View File

@ -12,7 +12,6 @@ import Assigning.Assignment hiding (Assignment, Error)
import qualified Assigning.Assignment as Assignment
import Data.Abstract.Name (name)
import qualified Data.Abstract.ScopeGraph as ScopeGraph (AccessControl(..))
import Data.List (elem)
import qualified Data.List.NonEmpty as NonEmpty
import Data.Syntax
( contextualize

View File

@ -4,10 +4,6 @@ module Language.Ruby.Syntax (module Language.Ruby.Syntax) where
import Prologue
import Control.Abstract as Abstract hiding (Load, String)
import Control.Abstract.Heap (Heap, HeapError, insertFrameLink)
import Control.Abstract.ScopeGraph (insertImportEdge)
import Control.Abstract.Value (Boolean)
import Control.Monad (unless)
import Data.Abstract.BaseError
import Data.Abstract.Evaluatable
import qualified Data.Abstract.Module as M

View File

@ -5,7 +5,6 @@ import Prologue
import Control.Abstract hiding (Import)
import Data.Abstract.Evaluatable as Evaluatable
import Data.Abstract.ScopeGraph (AccessControl (..))
import Data.JSON.Fields
import qualified Data.Map.Strict as Map
import Data.Semigroup.App

View File

@ -1,4 +1,5 @@
{-# LANGUAGE DataKinds, DeriveGeneric, FlexibleContexts, GADTs, LambdaCase, RecordWildCards, ScopedTypeVariables, TypeOperators #-}
{-# LANGUAGE DataKinds, DeriveGeneric, FlexibleContexts, GADTs, LambdaCase, RecordWildCards, ScopedTypeVariables,
TypeOperators #-}
module Parsing.TreeSitter
( TSParseException (..)
, Duration(..)
@ -13,7 +14,6 @@ import Control.Carrier.Reader
import qualified Control.Exception as Exc
import Foreign
import Foreign.C.Types (CBool (..))
import Foreign.Marshal.Array (allocaArray)
import Data.AST (AST, Node (Node))
import Data.Blob

View File

@ -8,25 +8,25 @@ module Prologue
) where
import Debug.Trace as X (traceShowM, traceM)
import Data.Bifunctor.Join as X
import Data.Bits as X
import Data.ByteString as X (ByteString)
import Data.Coerce as X
import Data.Int as X (Int8, Int16, Int32, Int64)
import Data.Either as X (fromLeft, fromRight)
import Data.Int as X (Int16, Int32, Int64, Int8)
import Data.IntMap as X (IntMap)
import Data.IntSet as X (IntSet)
import Data.Ix as X (Ix (..))
import Data.List.NonEmpty as X (NonEmpty (..), nonEmpty, some1)
import Data.Map as X (Map)
import Data.Maybe as X
import Data.Semilattice.Lower as X (Lower (..))
import Data.Sequence as X (Seq)
import Data.Semilattice.Lower as X (Lower(..))
import Data.Set as X (Set)
import Data.Sum as X (Sum, Element, Elements, (:<), (:<:), Apply (..), inject)
import Data.Sum as X ((:<), (:<:), Apply (..), Element, Elements, Sum, inject)
import Data.Text as X (Text)
import Data.Word as X (Word8, Word16, Word32, Word64)
import Data.Word as X (Word16, Word32, Word64, Word8)
import Debug.Trace as X (traceM, traceShowM)
import Control.Exception as X hiding (Handler (..), assert, evaluate, throw, throwIO, throwTo)
@ -43,12 +43,12 @@ import Data.Bifunctor as X (Bifunctor (..))
import Data.Bitraversable as X
import Data.Foldable as X hiding (product, sum)
import Data.Function as X (fix, on, (&))
import Data.Functor as X (void, ($>))
import Data.Functor as X (($>))
import Data.Functor.Classes as X
import Data.Functor.Classes.Generic as X
import Data.Functor.Foldable as X (Base, Corecursive (..), Recursive (..))
import Data.Hashable as X (Hashable, hash, hashUsing, hashWithSalt)
import Data.Hashable.Lifted as X (Hashable1(..), hashWithSalt1)
import Data.Hashable.Lifted as X (Hashable1 (..), hashWithSalt1)
import Data.Monoid as X (First (..), Last (..), Monoid (..))
import Data.Monoid.Generic as X
import Data.Proxy as X (Proxy (..))

View File

@ -13,7 +13,6 @@ module Rendering.JSON
, SomeJSON(..)
) where
import Data.Aeson (ToJSON, toJSON, object, (.=))
import Data.Aeson as A
import Data.Blob
import Data.JSON.Fields

View File

@ -10,7 +10,6 @@ import Prologue
import qualified Data.Map.Strict as Map
import Control.Abstract as Abstract
import Control.Abstract.ScopeGraph (runAllocator)
import Control.Algebra
import Control.Carrier.Error.Either
import Control.Carrier.Reader

View File

@ -3,7 +3,6 @@ module Semantic.CLI (main) where
import qualified Control.Carrier.Parse.Measured as Parse
import Control.Carrier.Reader
import Control.Exception as Exc (displayException)
import Data.Blob
import Data.Blob.IO
import qualified Data.Flag as Flag
@ -28,7 +27,7 @@ import qualified System.Path as Path
import qualified System.Path.PartClass as Path.PartClass
import Control.Concurrent (mkWeakThreadId, myThreadId)
import Control.Exception (Exception (..), throwTo)
import Control.Exception (throwTo)
import Proto.Semantic_JSON ()
import System.Mem.Weak (deRefWeak)
import System.Posix.Signals

View File

@ -66,7 +66,7 @@ instance MonadUnliftIO m => MonadUnliftIO (LiftC m) where
{-# INLINE withRunInIO #-}
newtype DistributeC m a = DistributeC { runDistributeC :: ReaderC (UnliftIO m) m a }
deriving (Functor, Applicative, Monad, MonadIO)
deriving (Functor, Applicative, Monad, MonadFail, MonadIO)
-- This can be simpler if we add an instance to fused-effects that takes
-- care of this folderol for us (then we can justt derive the MonadUnliftIO instance)

View File

@ -46,7 +46,6 @@ import Control.Lens.Getter
import Data.Abstract.Address.Hole as Hole
import Data.Abstract.Address.Monovariant as Monovariant
import Data.Abstract.Address.Precise as Precise
import Data.Abstract.BaseError (BaseError (..))
import Data.Abstract.Evaluatable
import Data.Abstract.Heap
import Data.Abstract.Module

View File

@ -14,7 +14,6 @@ import Data.Blob
import Data.Language
import qualified Data.Map as Map
import Data.Project
import GHC.Generics (Generic1)
import Prologue
import Semantic.Task.Files
import qualified Source.Source as Source
@ -55,7 +54,7 @@ runResolution :: ResolutionC m a -> m a
runResolution = runResolutionC
newtype ResolutionC m a = ResolutionC { runResolutionC :: m a }
deriving (Applicative, Functor, Monad, MonadIO)
deriving (Applicative, Functor, Monad, MonadFail, MonadIO)
instance (Has Files sig m, MonadIO m) => Algebra (Resolution :+: sig) (ResolutionC m) where
alg (R other) = ResolutionC . alg . handleCoercible $ other

View File

@ -1,4 +1,5 @@
{-# LANGUAGE FlexibleContexts, FlexibleInstances, GADTs, GeneralizedNewtypeDeriving, KindSignatures, MultiParamTypeClasses, RecordWildCards, ScopedTypeVariables, TypeOperators, UndecidableInstances #-}
{-# LANGUAGE FlexibleContexts, FlexibleInstances, GADTs, GeneralizedNewtypeDeriving, KindSignatures,
MultiParamTypeClasses, RecordWildCards, ScopedTypeVariables, TypeOperators, UndecidableInstances #-}
module Semantic.Task
( TaskC
, Level(..)
@ -128,7 +129,7 @@ runTraceInTelemetry :: TraceInTelemetryC m a
runTraceInTelemetry = runTraceInTelemetryC
newtype TraceInTelemetryC m a = TraceInTelemetryC { runTraceInTelemetryC :: m a }
deriving (Applicative, Functor, Monad, MonadIO)
deriving (Applicative, Functor, Monad, MonadFail, MonadIO)
instance Has Telemetry sig m => Algebra (Trace :+: sig) (TraceInTelemetryC m) where
alg (R other) = TraceInTelemetryC . alg . handleCoercible $ other

View File

@ -68,9 +68,9 @@ runFiles :: FilesC m a -> m a
runFiles = runFilesC
newtype FilesC m a = FilesC { runFilesC :: m a }
deriving (Functor, Applicative, Monad, MonadIO)
deriving (Functor, Applicative, Monad, MonadFail, MonadIO)
instance (Has (Error SomeException) sig m, MonadIO m) => Algebra (Files :+: sig) (FilesC m) where
instance (Has (Error SomeException) sig m, MonadFail m, MonadIO m) => Algebra (Files :+: sig) (FilesC m) where
alg (R other) = FilesC (alg (handleCoercible other))
alg (L op) = case op of
Read (FromPath path) k -> readBlobFromFile' path >>= k

View File

@ -148,7 +148,7 @@ runTelemetry :: LogQueue -> StatQueue -> TelemetryC m a -> m a
runTelemetry logger statter = runReader (logger, statter) . runTelemetryC
newtype TelemetryC m a = TelemetryC { runTelemetryC :: ReaderC (LogQueue, StatQueue) m a }
deriving (Applicative, Functor, Monad, MonadIO)
deriving (Applicative, Functor, Monad, MonadFail, MonadIO)
instance (Algebra sig m, MonadIO m) => Algebra (Telemetry :+: sig) (TelemetryC m) where
alg (L op) = do

View File

@ -32,7 +32,6 @@ import qualified Data.ByteString.Char8 as B
import Data.List (intercalate)
import Data.List.Split (splitOneOf)
import qualified Data.Time.Clock as Time
import qualified Data.Time.Clock.POSIX as Time (getCurrentTime)
import Network.Socket
(Socket (..), SocketType (..), addrAddress, addrFamily, close, connect, defaultProtocol, getAddrInfo, socket)
import Network.Socket.ByteString

View File

@ -53,7 +53,7 @@ runHandler :: Handler m -> TimeoutC m a -> IO a
runHandler h@(Handler handler) = handler . runReader h . runTimeoutC
newtype TimeoutC m a = TimeoutC { runTimeoutC :: ReaderC (Handler m) m a }
deriving (Functor, Applicative, Monad, MonadIO)
deriving (Functor, Applicative, Monad, MonadFail, MonadIO)
instance MonadUnliftIO m => MonadUnliftIO (TimeoutC m) where
askUnliftIO = TimeoutC . ReaderC $ \(Handler h) ->

View File

@ -12,8 +12,6 @@ module Semantic.Util
import Prelude hiding (readFile)
import Control.Abstract
import Control.Abstract.Heap (runHeapError)
import Control.Abstract.ScopeGraph (runScopeError)
import Control.Carrier.Fresh.Strict
import Control.Carrier.Parse.Simple
import Control.Carrier.Lift
@ -21,7 +19,6 @@ import Control.Carrier.Trace.Printing
import Control.Carrier.Reader
import Control.Carrier.Resumable.Either (SomeError (..))
import Control.Carrier.State.Strict
import Control.Exception (displayException)
import Control.Lens.Getter
import Data.Abstract.Address.Precise as Precise
import Data.Abstract.Evaluatable

View File

@ -9,7 +9,6 @@ import Data.Syntax.Statement (StatementBlock(..))
import qualified Data.Abstract.ScopeGraph as ScopeGraph (AccessControl(..))
import Data.Abstract.Evaluatable
import qualified Data.Abstract.Heap as Heap
import Data.Abstract.Module (ModuleInfo (..))
import qualified Data.Abstract.ModuleTable as ModuleTable
import Data.Abstract.Number as Number
import Data.Abstract.Package (PackageInfo (..))

View File

@ -5,7 +5,6 @@ import Assigning.Assignment
import Data.AST
import Data.Bifunctor (first)
import Data.Ix
import Data.Semigroup ((<>))
import Data.Term
import Data.Text as T (Text, length, words)
import Data.Text.Encoding (encodeUtf8)

View File

@ -3,7 +3,6 @@ module Diffing.Algorithm.RWS.Spec (spec) where
import Data.Bifunctor
import Data.Diff
import Data.Functor.Listable (ListableSyntax)
import Data.Sum
import qualified Data.Syntax as Syntax
import Data.Term

View File

@ -11,7 +11,6 @@ import Control.Effect.Parse
import "semantic" Data.Graph (Graph (..), topologicalSort)
import Data.Graph.ControlFlowVertex
import qualified Data.Language as Language
import Data.Maybe (fromJust)
import Semantic.Graph
import qualified System.Path as Path

View File

@ -3,7 +3,7 @@ module Integration.Spec (testTree) where
import Control.Exception (throw)
import Data.Foldable (find)
import Data.List (union, concat, transpose)
import Data.List (union, transpose)
import qualified Data.ByteString.Lazy as BL
import System.FilePath.Glob
import System.IO.Unsafe

View File

@ -5,7 +5,6 @@ import Control.Carrier.Reader
import Control.Exception (fromException)
import SpecHelpers
import Data.Blob (NoLanguageForBlob (..))
import Semantic.Api hiding (Blob)
-- we need some lenses here, oof

View File

@ -32,7 +32,6 @@ import Control.Carrier.Resumable.Either
import Control.Carrier.Lift
import Control.Carrier.State.Strict
import Control.Exception (displayException)
import Control.Monad ((>=>))
import Control.Monad as X
import Data.Abstract.Address.Precise as X
import Data.Abstract.Evaluatable
@ -41,7 +40,6 @@ import qualified Data.Abstract.Heap as Heap
import Data.Abstract.Module as X
import Data.Abstract.ModuleTable as X hiding (lookup)
import Data.Abstract.Name as X
import Data.Abstract.ScopeGraph (EdgeLabel(..))
import qualified Data.Abstract.ScopeGraph as ScopeGraph
import Data.Abstract.Value.Concrete (Value(..), ValueError, runValueError)
import Data.Blob as X

View File

@ -8,7 +8,6 @@ import Control.Exception
import Data.Bifunctor (first)
import Data.List (intercalate)
import Data.Maybe (listToMaybe)
import GHC.Show as Show (showsPrec)
import Test.Hspec
import Test.Hspec.Core.Spec as Hspec
import qualified Test.HUnit.Lang as HUnit