From e6cdffccddfc5b723f2d6e54502d881e0c374173 Mon Sep 17 00:00:00 2001 From: Brent Yorgey Date: Wed, 22 May 2024 08:40:26 -0500 Subject: [PATCH] apply fourmolu formatting --- src/Disco/AST/Surface.hs | 12 ++++++------ src/Disco/Desugar.hs | 4 ++-- src/Disco/Interactive/Commands.hs | 2 +- src/Disco/Module.hs | 8 ++++---- src/Disco/Parser.hs | 4 ++-- src/Disco/Pretty/Prec.hs | 2 +- src/Disco/Typecheck.hs | 6 +++--- src/Disco/Typecheck/Solve.hs | 1 - src/Disco/Typecheck/Unify.hs | 2 +- 9 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/Disco/AST/Surface.hs b/src/Disco/AST/Surface.hs index 119a5fbb..bcb2e43e 100644 --- a/src/Disco/AST/Surface.hs +++ b/src/Disco/AST/Surface.hs @@ -108,25 +108,25 @@ module Disco.AST.Surface ( ) where -import Data.List.NonEmpty (NonEmpty) -import qualified Data.List.NonEmpty as NE -import Prelude hiding ((<>)) import Control.Lens ((%~), _1, _2, _3) import Data.Char (toLower) +import Data.List.NonEmpty (NonEmpty) +import qualified Data.List.NonEmpty as NE import qualified Data.Map as M import Data.Set (Set) import qualified Data.Set as S import Data.Void -import Disco.Effects.LFresh -import Polysemy hiding (Embed, embed) -import Polysemy.Reader import Disco.AST.Generic +import Disco.Effects.LFresh import Disco.Extensions import Disco.Pretty import Disco.Syntax.Operators import Disco.Syntax.Prims import Disco.Types +import Polysemy hiding (Embed, embed) +import Polysemy.Reader import Unbound.Generics.LocallyNameless hiding (LFresh (..), lunbind) +import Prelude hiding ((<>)) -- | The extension descriptor for Surface specific AST types. data UD diff --git a/src/Disco/Desugar.hs b/src/Disco/Desugar.hs index 61c8e7f6..7319a60c 100644 --- a/src/Disco/Desugar.hs +++ b/src/Disco/Desugar.hs @@ -25,19 +25,19 @@ where import Control.Monad (zipWithM) import Data.Bool (bool) import Data.Coerce -import Data.List.NonEmpty (NonEmpty(..)) +import Data.List.NonEmpty (NonEmpty (..)) import qualified Data.List.NonEmpty as NE import Data.Maybe (fromMaybe, isJust) import Disco.AST.Desugared import Disco.AST.Surface import Disco.AST.Typed +import Disco.Effects.Fresh import Disco.Module import Disco.Names import Disco.Syntax.Operators import Disco.Syntax.Prims import Disco.Typecheck (containerTy) import Disco.Types -import Disco.Effects.Fresh import Polysemy (Member, Sem, run) import Unbound.Generics.LocallyNameless ( Bind, diff --git a/src/Disco/Interactive/Commands.hs b/src/Disco/Interactive/Commands.hs index 35905e4b..0543be1d 100644 --- a/src/Disco/Interactive/Commands.hs +++ b/src/Disco/Interactive/Commands.hs @@ -27,7 +27,7 @@ import Control.Lens ( (?~), (^.), ) -import Control.Monad (forM_, when, void) +import Control.Monad (forM_, void, when) import Control.Monad.Except () import Data.Bifunctor (second) import Data.Char (isSpace) diff --git a/src/Disco/Module.hs b/src/Disco/Module.hs index bff48c4d..6ae4be8d 100644 --- a/src/Disco/Module.hs +++ b/src/Disco/Module.hs @@ -15,10 +15,6 @@ -- to resolve the location of a module on disk. module Disco.Module where -import Data.List.NonEmpty (NonEmpty) -import qualified Data.List.NonEmpty as NE -import Data.Data (Data) -import GHC.Generics (Generic) import Control.Lens ( Getting, foldOf, @@ -28,10 +24,14 @@ import Control.Lens ( import Control.Monad (filterM) import Control.Monad.IO.Class (MonadIO (..)) import Data.Bifunctor (first) +import Data.Data (Data) +import Data.List.NonEmpty (NonEmpty) +import qualified Data.List.NonEmpty as NE import Data.Map (Map) import qualified Data.Map as M import Data.Maybe (listToMaybe) import qualified Data.Set as S +import GHC.Generics (Generic) import System.Directory (doesFileExist) import System.FilePath ( replaceExtension, diff --git a/src/Disco/Parser.hs b/src/Disco/Parser.hs index 9ebcbbd8..74f07149 100644 --- a/src/Disco/Parser.hs +++ b/src/Disco/Parser.hs @@ -543,8 +543,8 @@ parseModule mode = do defnGroups [] = [] defnGroups (d@DType {} : ds) = d : defnGroups ds defnGroups (d@DTyDef {} : ds) = d : defnGroups ds - defnGroups (DDefn (TermDefn x bs) : ds) - = DDefn (TermDefn x (bs `NE.appendList` concatMap (\(TermDefn _ cs) -> NE.toList cs) grp)) + defnGroups (DDefn (TermDefn x bs) : ds) = + DDefn (TermDefn x (bs `NE.appendList` concatMap (\(TermDefn _ cs) -> NE.toList cs) grp)) : defnGroups rest where (grp, rest) = matchDefn ds diff --git a/src/Disco/Pretty/Prec.hs b/src/Disco/Pretty/Prec.hs index e3936536..29b53fb7 100644 --- a/src/Disco/Pretty/Prec.hs +++ b/src/Disco/Pretty/Prec.hs @@ -19,7 +19,7 @@ import Disco.Syntax.Operators type Prec = Int data PA = PA Prec BFixity - deriving (Show, Eq) -- Do NOT derive Ord, see note below. + deriving (Show, Eq) -- Do NOT derive Ord, see note below. lowerPrec :: PA -> PA -> Bool lowerPrec (PA p1 a1) (PA p2 a2) = p1 < p2 || (p1 == p2 && a1 /= a2) diff --git a/src/Disco/Typecheck.hs b/src/Disco/Typecheck.hs index 0c294120..0ed3df14 100644 --- a/src/Disco/Typecheck.hs +++ b/src/Disco/Typecheck.hs @@ -15,13 +15,13 @@ module Disco.Typecheck where import Control.Arrow ((&&&)) import Control.Lens ((^..)) -import Control.Monad (when, zipWithM, forM_, unless) +import Control.Monad (forM_, unless, when, zipWithM) import Control.Monad.Trans.Maybe import Data.Bifunctor (first) import Data.Coerce import qualified Data.Foldable as F import Data.List (sort) -import Data.List.NonEmpty (NonEmpty(..)) +import Data.List.NonEmpty (NonEmpty (..)) import qualified Data.List.NonEmpty as NE import Data.Map (Map) import qualified Data.Map as M @@ -309,7 +309,7 @@ checkDefn name (TermDefn x clauses) = mapError (LocTCError (Just (name .- x))) $ -- patterns don't match across different clauses | otherwise = return () - -- | Check a clause of a definition against a list of pattern types and a body type. + -- \| Check a clause of a definition against a list of pattern types and a body type. checkClause :: Members '[Reader TyCtx, Reader TyDefCtx, Writer Constraint, Error TCError, Fresh] r => [Type] -> diff --git a/src/Disco/Typecheck/Solve.hs b/src/Disco/Typecheck/Solve.hs index 5d00e431..ba8bbf12 100644 --- a/src/Disco/Typecheck/Solve.hs +++ b/src/Disco/Typecheck/Solve.hs @@ -1127,7 +1127,6 @@ solveGraph vm g = atomToTypeSubst . unifyWCC <$> go topRelMap if getSort vm v == S.fromList [QBool] then Just (coerce v |-> B) else -- Debug.trace (show v ++ " has no sub- or supertypes. Assuming N as a subtype.") - (coerce v |->) <$> lubBySort vm diff --git a/src/Disco/Typecheck/Unify.hs b/src/Disco/Typecheck/Unify.hs index 326b42f1..1d97d995 100644 --- a/src/Disco/Typecheck/Unify.hs +++ b/src/Disco/Typecheck/Unify.hs @@ -14,8 +14,8 @@ module Disco.Typecheck.Unify where import Unbound.Generics.LocallyNameless (Name, fv) -import Control.Monad (mzero) import Control.Lens (anyOf) +import Control.Monad (mzero) import Control.Monad.State import qualified Data.Map as M import Data.Set (Set)