Skip to content

Commit

Permalink
Merge pull request #3022 from unisonweb/22-03-31-warning-free-ghci
Browse files Browse the repository at this point in the history
Use explicit deriving strategies where it's ambiguous
  • Loading branch information
mitchellwrosen committed Apr 4, 2022
2 parents 9a2e90e + 92e9e37 commit 548caae
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 39 deletions.
3 changes: 2 additions & 1 deletion lib/unison-pretty-printer/src/Unison/Util/Pretty.hs
Expand Up @@ -158,7 +158,8 @@ import qualified Unison.Util.SyntaxText as ST
import Prelude hiding (lines, map)

newtype Width = Width {widthToInt :: Int}
deriving (Eq, Ord, Show, Generic, Num, Bounded)
deriving stock (Eq, Ord, Show, Generic)
deriving newtype (Num, Bounded)

type ColorText = CT.ColorText

Expand Down
46 changes: 24 additions & 22 deletions parser-typechecker/package.yaml
Expand Up @@ -2,28 +2,6 @@ name: unison-parser-typechecker
github: unisonweb/unison
copyright: Copyright (C) 2013-2021 Unison Computing, PBC and contributors

default-extensions:
- ApplicativeDo
- BangPatterns
- BlockArguments
- DeriveFunctor
- DeriveGeneric
- DerivingStrategies
- DoAndIfThenElse
- FlexibleContexts
- FlexibleInstances
- GeneralizedNewtypeDeriving
- LambdaCase
- MultiParamTypeClasses
- NamedFieldPuns
- OverloadedStrings
- PatternSynonyms
- RankNTypes
- ScopedTypeVariables
- TupleSections
- TypeApplications
- ViewPatterns

ghc-options: -Wall -O0 -fno-warn-name-shadowing -fno-warn-missing-pattern-synonym-signatures

flags:
Expand Down Expand Up @@ -180,3 +158,27 @@ executables:
- unison-util
- unison-util-relation
- unison-pretty-printer

default-extensions:
- ApplicativeDo
- BangPatterns
- BlockArguments
- DeriveFunctor
- DeriveGeneric
- DeriveTraversable
- DerivingStrategies
- DerivingVia
- DoAndIfThenElse
- FlexibleContexts
- FlexibleInstances
- GeneralizedNewtypeDeriving
- LambdaCase
- MultiParamTypeClasses
- NamedFieldPuns
- OverloadedStrings
- PatternSynonyms
- RankNTypes
- ScopedTypeVariables
- TupleSections
- TypeApplications
- ViewPatterns
4 changes: 3 additions & 1 deletion parser-typechecker/src/Unison/Codebase/Path.hs
Expand Up @@ -84,7 +84,9 @@ import Unison.Prelude hiding (empty, toList)
import Unison.Util.Monoid (intercalateMap)

-- `Foo.Bar.baz` becomes ["Foo", "Bar", "baz"]
newtype Path = Path {toSeq :: Seq NameSegment} deriving (Eq, Ord, Semigroup, Monoid)
newtype Path = Path {toSeq :: Seq NameSegment}
deriving stock (Eq, Ord)
deriving newtype (Semigroup, Monoid)

newtype Absolute = Absolute {unabsolute :: Path} deriving (Eq, Ord)

Expand Down
8 changes: 6 additions & 2 deletions parser-typechecker/src/Unison/Runtime/ANF.hs
Expand Up @@ -477,9 +477,13 @@ data ANormalF v e
-- Types representing components that will go into the runtime tag of
-- a data type value. RTags correspond to references, while CTags
-- correspond to constructors.
newtype RTag = RTag Word64 deriving (Eq, Ord, Show, Read, EC.EnumKey)
newtype RTag = RTag Word64
deriving stock (Eq, Ord, Show, Read)
deriving newtype (EC.EnumKey)

newtype CTag = CTag Word16 deriving (Eq, Ord, Show, Read, EC.EnumKey)
newtype CTag = CTag Word16
deriving stock (Eq, Ord, Show, Read)
deriving newtype (EC.EnumKey)

class Tag t where rawTag :: t -> Word64

Expand Down
4 changes: 3 additions & 1 deletion parser-typechecker/src/Unison/Util/Bytes.hs
Expand Up @@ -87,7 +87,9 @@ import Prelude hiding (drop, take)
type Chunk = V.Vector Word8

-- Bytes type represented as a rope of ByteStrings
newtype Bytes = Bytes {underlying :: R.Rope Chunk} deriving (Semigroup, Monoid, Eq, Ord)
newtype Bytes = Bytes {underlying :: R.Rope Chunk}
deriving stock (Eq, Ord)
deriving newtype (Semigroup, Monoid)

instance R.Sized Chunk where size = V.length

Expand Down
23 changes: 12 additions & 11 deletions parser-typechecker/src/Unison/Util/EnumContainers.hs
@@ -1,6 +1,3 @@
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}

module Unison.Util.EnumContainers
( EnumMap,
EnumSet,
Expand Down Expand Up @@ -49,25 +46,29 @@ instance EnumKey Word16 where
intToKey i = fromIntegral i

newtype EnumMap k a = EM (IM.IntMap a)
deriving
( Monoid,
Semigroup,
Functor,
deriving stock
( Functor,
Foldable,
Traversable,
Show,
Eq,
Ord
)
deriving newtype
( Monoid,
Semigroup
)

newtype EnumSet k = ES IS.IntSet
deriving
( Monoid,
Semigroup,
Show,
deriving stock
( Show,
Eq,
Ord
)
deriving newtype
( Monoid,
Semigroup
)

mapFromList :: EnumKey k => [(k, a)] -> EnumMap k a
mapFromList = EM . IM.fromList . fmap (first keyToInt)
Expand Down
4 changes: 3 additions & 1 deletion parser-typechecker/src/Unison/Util/Text.hs
Expand Up @@ -14,7 +14,9 @@ import qualified Unison.Util.Rope as R
import Prelude hiding (drop, replicate, take)

-- Text type represented as a `Rope` of chunks
newtype Text = Text (R.Rope Chunk) deriving (Eq, Ord, Semigroup, Monoid)
newtype Text = Text (R.Rope Chunk)
deriving stock (Eq, Ord)
deriving newtype (Semigroup, Monoid)

data Chunk = Chunk {-# UNPACK #-} !Int {-# UNPACK #-} !T.Text

Expand Down
4 changes: 4 additions & 0 deletions parser-typechecker/unison-parser-typechecker.cabal
Expand Up @@ -188,7 +188,9 @@ library
BlockArguments
DeriveFunctor
DeriveGeneric
DeriveTraversable
DerivingStrategies
DerivingVia
DoAndIfThenElse
FlexibleContexts
FlexibleInstances
Expand Down Expand Up @@ -352,7 +354,9 @@ executable tests
BlockArguments
DeriveFunctor
DeriveGeneric
DeriveTraversable
DerivingStrategies
DerivingVia
DoAndIfThenElse
FlexibleContexts
FlexibleInstances
Expand Down

0 comments on commit 548caae

Please sign in to comment.