From 7abf0e184cf32991dfc276b0cd8dc29027cdc961 Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Fri, 19 Aug 2022 12:29:36 +0800 Subject: [PATCH] remove monad, typeoperators, and some spurious imports warnings --- basement/Basement/Block.hs | 1 + basement/Basement/Block/Base.hs | 1 - basement/Basement/Block/Builder.hs | 5 ++--- basement/Basement/Bounded.hs | 1 + basement/Basement/BoxedArray.hs | 2 +- basement/Basement/Cast.hs | 1 + basement/Basement/Compat/MonadTrans.hs | 4 ++-- basement/Basement/IntegralConv.hs | 1 + basement/Basement/Numerical/Conversion.hs | 6 ------ basement/Basement/Types/OffsetSize.hs | 1 - basement/Basement/UArray/Base.hs | 1 - foundation/Foundation/Array/Bitmap.hs | 1 - foundation/Foundation/Array/Chunked/Unboxed.hs | 1 - foundation/Foundation/Check/Gen.hs | 2 +- foundation/Foundation/Check/Main.hs | 10 ++++++---- foundation/Foundation/Check/Property.hs | 1 - foundation/Foundation/Class/Storable.hs | 4 +--- foundation/Foundation/Collection/Buildable.hs | 3 ++- foundation/Foundation/Collection/Collection.hs | 1 + foundation/Foundation/Collection/InnerFunctor.hs | 1 + foundation/Foundation/Collection/Sequential.hs | 1 + foundation/Foundation/Collection/Zippable.hs | 1 + foundation/Foundation/Conduit.hs | 1 + foundation/Foundation/Conduit/Internal.hs | 2 +- foundation/Foundation/Conduit/Textual.hs | 2 -- foundation/Foundation/Exception.hs | 2 +- foundation/Foundation/Format/CSV/Types.hs | 5 ++--- foundation/Foundation/List/DList.hs | 3 +-- foundation/Foundation/Monad.hs | 3 +-- foundation/Foundation/Monad/Except.hs | 2 +- foundation/Foundation/Monad/Identity.hs | 2 +- foundation/Foundation/Monad/Reader.hs | 2 +- foundation/Foundation/Monad/State.hs | 2 +- foundation/Foundation/Network/IPv4.hs | 1 + foundation/Foundation/Network/IPv6.hs | 2 +- foundation/Foundation/Parser.hs | 1 + foundation/Foundation/Random/DRG.hs | 2 +- foundation/Foundation/UUID.hs | 1 + foundation/Foundation/VFS/FilePath.hs | 1 - 39 files changed, 39 insertions(+), 45 deletions(-) diff --git a/basement/Basement/Block.hs b/basement/Basement/Block.hs index 90c5db1b..7597123d 100644 --- a/basement/Basement/Block.hs +++ b/basement/Basement/Block.hs @@ -16,6 +16,7 @@ {-# LANGUAGE UnboxedTuples #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE TypeOperators #-} module Basement.Block ( Block(..) , MutableBlock(..) diff --git a/basement/Basement/Block/Base.hs b/basement/Basement/Block/Base.hs index 27805295..62b914ac 100644 --- a/basement/Basement/Block/Base.hs +++ b/basement/Basement/Block/Base.hs @@ -82,7 +82,6 @@ instance PrimType ty => Semigroup (Block ty) where (<>) = append instance PrimType ty => Monoid (Block ty) where mempty = empty - mappend = append mconcat = concat instance PrimType ty => IsList (Block ty) where diff --git a/basement/Basement/Block/Builder.hs b/basement/Basement/Block/Builder.hs index bae69807..08cbe688 100644 --- a/basement/Basement/Block/Builder.hs +++ b/basement/Basement/Block/Builder.hs @@ -6,6 +6,7 @@ -- Block builder {-# LANGUAGE Rank2Types #-} +{-# LANGUAGE TypeOperators #-} module Basement.Block.Builder ( Builder @@ -57,9 +58,7 @@ instance Semigroup Builder where {-# INLINABLE (<>) #-} instance Monoid Builder where mempty = empty - {-# INLINE mempty #-} - mappend = append - {-# INLINABLE mappend #-} + {-# INLINABLE mempty #-} mconcat = concat {-# INLINABLE mconcat #-} diff --git a/basement/Basement/Bounded.hs b/basement/Basement/Bounded.hs index a1e06f6c..49fc02f6 100644 --- a/basement/Basement/Bounded.hs +++ b/basement/Basement/Bounded.hs @@ -11,6 +11,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE TypeOperators #-} module Basement.Bounded ( Zn64 , unZn64 diff --git a/basement/Basement/BoxedArray.hs b/basement/Basement/BoxedArray.hs index 72d5de89..8ca34f5d 100644 --- a/basement/Basement/BoxedArray.hs +++ b/basement/Basement/BoxedArray.hs @@ -13,6 +13,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE TypeOperators #-} module Basement.BoxedArray ( Array , MArray @@ -132,7 +133,6 @@ instance Semigroup (Array a) where (<>) = append instance Monoid (Array a) where mempty = empty - mappend = append mconcat = concat instance Show a => Show (Array a) where diff --git a/basement/Basement/Cast.hs b/basement/Basement/Cast.hs index 53e1fe9b..7856f803 100644 --- a/basement/Basement/Cast.hs +++ b/basement/Basement/Cast.hs @@ -4,6 +4,7 @@ {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeOperators #-} -- | -- Module : Basement.Cast -- License : BSD-style diff --git a/basement/Basement/Compat/MonadTrans.hs b/basement/Basement/Compat/MonadTrans.hs index 70af3bc2..ef3d5c1e 100644 --- a/basement/Basement/Compat/MonadTrans.hs +++ b/basement/Basement/Compat/MonadTrans.hs @@ -27,7 +27,7 @@ instance Monad m => Applicative (State s m) where (a,s3) <- runState fa s2 return (ab a, s3) instance Monad m => Monad (State r m) where - return a = State $ \st -> return (a,st) + return = pure ma >>= mb = State $ \s1 -> do (a,s2) <- runState ma s1 runState (mb a) s2 @@ -44,7 +44,7 @@ instance Monad m => Applicative (Reader r m) where ab <- runReader fab r return $ ab a instance Monad m => Monad (Reader r m) where - return a = Reader $ \_ -> return a + return = pure ma >>= mb = Reader $ \r -> do a <- runReader ma r runReader (mb a) r diff --git a/basement/Basement/IntegralConv.hs b/basement/Basement/IntegralConv.hs index 26ebcdcd..fd74f6ae 100644 --- a/basement/Basement/IntegralConv.hs +++ b/basement/Basement/IntegralConv.hs @@ -6,6 +6,7 @@ {-# LANGUAGE UnboxedTuples #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} +{-# LANGUAGE TypeOperators #-} module Basement.IntegralConv ( IntegralDownsize(..) , IntegralUpsize(..) diff --git a/basement/Basement/Numerical/Conversion.hs b/basement/Basement/Numerical/Conversion.hs index 6f8c1c96..db502c07 100644 --- a/basement/Basement/Numerical/Conversion.hs +++ b/basement/Basement/Numerical/Conversion.hs @@ -29,12 +29,6 @@ import Basement.Compat.Primitive import GHC.IntWord64 #endif -#if __GLASGOW_HASKELL__ >= 904 - -#else - -#endif - intToInt64 :: Int -> Int64 #if WORD_SIZE_IN_BITS == 64 #if __GLASGOW_HASKELL__ >= 904 diff --git a/basement/Basement/Types/OffsetSize.hs b/basement/Basement/Types/OffsetSize.hs index 26260593..cd944927 100644 --- a/basement/Basement/Types/OffsetSize.hs +++ b/basement/Basement/Types/OffsetSize.hs @@ -210,7 +210,6 @@ instance Semigroup (CountOf ty) where instance Monoid (CountOf ty) where mempty = azero - mappend = (+) mconcat = foldl' (+) 0 sizeOfE :: CountOf Word8 -> CountOf ty -> CountOf Word8 diff --git a/basement/Basement/UArray/Base.hs b/basement/Basement/UArray/Base.hs index ecd23759..08ef7ade 100644 --- a/basement/Basement/UArray/Base.hs +++ b/basement/Basement/UArray/Base.hs @@ -133,7 +133,6 @@ instance PrimType ty => Semigroup (UArray ty) where (<>) = append instance PrimType ty => Monoid (UArray ty) where mempty = empty - mappend = append mconcat = concat instance PrimType ty => IsList (UArray ty) where diff --git a/foundation/Foundation/Array/Bitmap.hs b/foundation/Foundation/Array/Bitmap.hs index e9a1d9be..f73a02f6 100644 --- a/foundation/Foundation/Array/Bitmap.hs +++ b/foundation/Foundation/Array/Bitmap.hs @@ -71,7 +71,6 @@ instance Semigroup Bitmap where (<>) = append instance Monoid Bitmap where mempty = empty - mappend = append mconcat = concat type instance C.Element Bitmap = Bool diff --git a/foundation/Foundation/Array/Chunked/Unboxed.hs b/foundation/Foundation/Array/Chunked/Unboxed.hs index 0ed60cec..60ac7a31 100644 --- a/foundation/Foundation/Array/Chunked/Unboxed.hs +++ b/foundation/Foundation/Array/Chunked/Unboxed.hs @@ -47,7 +47,6 @@ instance Semigroup (ChunkedUArray a) where (<>) = append instance Monoid (ChunkedUArray a) where mempty = empty - mappend = append mconcat = concat type instance C.Element (ChunkedUArray ty) = ty diff --git a/foundation/Foundation/Check/Gen.hs b/foundation/Foundation/Check/Gen.hs index 3a327204..2e6b2513 100644 --- a/foundation/Foundation/Check/Gen.hs +++ b/foundation/Foundation/Check/Gen.hs @@ -60,7 +60,7 @@ instance Applicative Gen where in ab a instance Monad Gen where - return a = Gen (\_ _ -> a) + return = pure ma >>= mb = Gen $ \rng params -> let (r1,r2) = genGenerator rng a = runGen ma r1 params diff --git a/foundation/Foundation/Check/Main.hs b/foundation/Foundation/Check/Main.hs index 1f75b69b..d838b273 100644 --- a/foundation/Foundation/Check/Main.hs +++ b/foundation/Foundation/Check/Main.hs @@ -273,10 +273,12 @@ testCheckPlan name actions = do then return (GroupResult name 0 (planValidations st) []) else do displayCurrent name - forM_ fails $ \(PropertyResult name' nb r) -> - case r of - PropertySuccess -> whenVerbose $ displayPropertySucceed (name <> ": " <> name') nb - PropertyFailed w -> whenErrorOnly $ displayPropertyFailed (name <> ": " <> name') nb w + forM_ fails $ \fail -> case fail of + PropertyResult name' nb r -> + case r of + PropertySuccess -> whenVerbose $ displayPropertySucceed (name <> ": " <> name') nb + PropertyFailed w -> whenErrorOnly $ displayPropertyFailed (name <> ": " <> name') nb w + _ -> error "should not happen" return (GroupResult name (length fails) (planValidations st) fails) testProperty :: String -> Property -> CheckMain TestResult diff --git a/foundation/Foundation/Check/Property.hs b/foundation/Foundation/Check/Property.hs index e5b13374..71a377ea 100644 --- a/foundation/Foundation/Check/Property.hs +++ b/foundation/Foundation/Check/Property.hs @@ -18,7 +18,6 @@ module Foundation.Check.Property ) where import Basement.Imports hiding (Typeable) -import Data.Proxy (Proxy(..)) import Basement.Compat.Typeable import Foundation.Check.Gen import Foundation.Check.Arbitrary diff --git a/foundation/Foundation/Class/Storable.hs b/foundation/Foundation/Class/Storable.hs index d498770d..d97b3482 100644 --- a/foundation/Foundation/Class/Storable.hs +++ b/foundation/Foundation/Class/Storable.hs @@ -30,8 +30,6 @@ module Foundation.Class.Storable #include "MachDeps.h" -import GHC.Types (Double, Float) - import Foreign.Ptr (castPtr) import qualified Foreign.Ptr import qualified Foreign.Storable (peek, poke) @@ -42,7 +40,7 @@ import Basement.Types.OffsetSize import Basement.Types.Word128 (Word128(..)) import Basement.Types.Word256 (Word256(..)) import Foundation.Collection -import Foundation.Collection.Buildable (builderLift, build_) +import Foundation.Collection.Buildable (builderLift) import Basement.PrimType import Basement.Endianness import Foundation.Numerical diff --git a/foundation/Foundation/Collection/Buildable.hs b/foundation/Foundation/Collection/Buildable.hs index 9db741a4..0ef9b631 100644 --- a/foundation/Foundation/Collection/Buildable.hs +++ b/foundation/Foundation/Collection/Buildable.hs @@ -24,6 +24,7 @@ import Basement.Compat.Base import Basement.Monad import Basement.MutableBuilder import Basement.Compat.MonadTrans +import Data.Kind (Type) -- $setup -- >>> import Control.Monad.ST @@ -42,7 +43,7 @@ class Buildable col where {-# MINIMAL append, build #-} -- | Mutable collection type used for incrementally writing chunks. - type Mutable col :: * -> * + type Mutable col :: Type -> Type -- | Unit of the smallest step possible in an `append` operation. -- diff --git a/foundation/Foundation/Collection/Collection.hs b/foundation/Foundation/Collection/Collection.hs index 4ca4dd64..12fb491a 100644 --- a/foundation/Foundation/Collection/Collection.hs +++ b/foundation/Foundation/Collection/Collection.hs @@ -20,6 +20,7 @@ {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} module Foundation.Collection.Collection ( Collection(..) -- * NonEmpty Property diff --git a/foundation/Foundation/Collection/InnerFunctor.hs b/foundation/Foundation/Collection/InnerFunctor.hs index 3b252be3..c0d4b598 100644 --- a/foundation/Foundation/Collection/InnerFunctor.hs +++ b/foundation/Foundation/Collection/InnerFunctor.hs @@ -1,4 +1,5 @@ {-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE TypeOperators #-} module Foundation.Collection.InnerFunctor ( InnerFunctor(..) ) where diff --git a/foundation/Foundation/Collection/Sequential.hs b/foundation/Foundation/Collection/Sequential.hs index 3a46d65c..4d8179f3 100644 --- a/foundation/Foundation/Collection/Sequential.hs +++ b/foundation/Foundation/Collection/Sequential.hs @@ -14,6 +14,7 @@ {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TypeOperators #-} module Foundation.Collection.Sequential ( Sequential(..) ) where diff --git a/foundation/Foundation/Collection/Zippable.hs b/foundation/Foundation/Collection/Zippable.hs index 77825278..ff1e2168 100644 --- a/foundation/Foundation/Collection/Zippable.hs +++ b/foundation/Foundation/Collection/Zippable.hs @@ -12,6 +12,7 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} module Foundation.Collection.Zippable ( BoxedZippable(..) , Zippable(..) diff --git a/foundation/Foundation/Conduit.hs b/foundation/Foundation/Conduit.hs index 0845c8a4..61440aa9 100644 --- a/foundation/Foundation/Conduit.hs +++ b/foundation/Foundation/Conduit.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE TypeOperators #-} module Foundation.Conduit ( Conduit , ResourceT diff --git a/foundation/Foundation/Conduit/Internal.hs b/foundation/Foundation/Conduit/Internal.hs index 509061eb..e2182975 100644 --- a/foundation/Foundation/Conduit/Internal.hs +++ b/foundation/Foundation/Conduit/Internal.hs @@ -79,7 +79,7 @@ instance Applicative m => Applicative (Pipe l i o u m) where {-# INLINE (<*>) #-} instance (Functor m, Monad m) => Monad (Pipe l i o u m) where - return = Done + return = pure {-# INLINE return #-} Yield p c o >>= fp = Yield (p >>= fp) c o diff --git a/foundation/Foundation/Conduit/Textual.hs b/foundation/Foundation/Conduit/Textual.hs index d3c2c1b4..de852ae5 100644 --- a/foundation/Foundation/Conduit/Textual.hs +++ b/foundation/Foundation/Conduit/Textual.hs @@ -7,8 +7,6 @@ module Foundation.Conduit.Textual ) where import Basement.Imports hiding (throw) -import Basement.UArray (UArray) -import Foundation.String (String) import Foundation.Collection import qualified Basement.String as S import Foundation.Conduit.Internal diff --git a/foundation/Foundation/Exception.hs b/foundation/Foundation/Exception.hs index d4c35b45..68fe9d85 100644 --- a/foundation/Foundation/Exception.hs +++ b/foundation/Foundation/Exception.hs @@ -5,7 +5,7 @@ module Foundation.Exception ) where import Basement.Imports -import Control.Exception (Exception, SomeException) +import Control.Exception (SomeException) import Foundation.Monad.Exception finally :: MonadBracket m => m a -> m b -> m a diff --git a/foundation/Foundation/Format/CSV/Types.hs b/foundation/Foundation/Format/CSV/Types.hs index 1bb3e44f..cada7010 100644 --- a/foundation/Foundation/Format/CSV/Types.hs +++ b/foundation/Foundation/Format/CSV/Types.hs @@ -31,14 +31,13 @@ module Foundation.Format.CSV.Types ) where import Basement.Imports -import Basement.BoxedArray (Array, length, unsafeIndex) +import Basement.BoxedArray (length, unsafeIndex) import Basement.NormalForm (NormalForm(..)) import Basement.From (Into, into) -import Basement.String (String, any, elem, null, uncons) +import Basement.String (any, elem, null, uncons) import qualified Basement.String as String (singleton) import Basement.Types.Word128 (Word128) import Basement.Types.Word256 (Word256) -import Basement.Types.OffsetSize (Offset, CountOf) import Foundation.Collection.Element (Element) import Foundation.Collection.Collection (Collection, nonEmpty_) import Foundation.Collection.Sequential (Sequential) diff --git a/foundation/Foundation/List/DList.hs b/foundation/Foundation/List/DList.hs index a38f19cd..9316928f 100644 --- a/foundation/Foundation/List/DList.hs +++ b/foundation/Foundation/List/DList.hs @@ -37,7 +37,6 @@ instance Semigroup (DList a) where (<>) dl1 dl2 = DList $ unDList dl1 . unDList dl2 instance Monoid (DList a) where mempty = DList id - mappend dl1 dl2 = DList $ unDList dl1 . unDList dl2 instance Functor DList where fmap f = foldr (cons . f) mempty @@ -48,7 +47,7 @@ instance Applicative DList where instance Monad DList where (>>=) m k = foldr (mappend . k) mempty m - return = singleton + return = pure type instance Element (DList a) = a diff --git a/foundation/Foundation/Monad.hs b/foundation/Foundation/Monad.hs index 4e582936..a07fa171 100644 --- a/foundation/Foundation/Monad.hs +++ b/foundation/Foundation/Monad.hs @@ -20,7 +20,6 @@ import Foundation.Monad.MonadIO import Foundation.Monad.Exception import Foundation.Monad.Transformer import Foundation.Numerical -import Control.Applicative (liftA2) #if MIN_VERSION_base(4,8,0) import Data.Functor.Identity @@ -66,5 +65,5 @@ replicateM (CountOf count) f = loop count where loop cnt | cnt <= 0 = pure [] - | otherwise = liftA2 (:) f (loop (cnt - 1)) + | otherwise = (:) <$> f <*> (loop (cnt - 1)) {-# INLINEABLE replicateM #-} diff --git a/foundation/Foundation/Monad/Except.hs b/foundation/Foundation/Monad/Except.hs index fd2307c7..ee1ddf4f 100644 --- a/foundation/Foundation/Monad/Except.hs +++ b/foundation/Foundation/Monad/Except.hs @@ -35,7 +35,7 @@ instance Monad m => MonadFailure (ExceptT e m) where mFail = ExceptT . pure . Left instance Monad m => Monad (ExceptT e m) where - return a = ExceptT $ return (Right a) + return = pure m >>= k = ExceptT $ do a <- runExceptT m case a of diff --git a/foundation/Foundation/Monad/Identity.hs b/foundation/Foundation/Monad/Identity.hs index bdc6e547..4c52cbe6 100644 --- a/foundation/Foundation/Monad/Identity.hs +++ b/foundation/Foundation/Monad/Identity.hs @@ -28,7 +28,7 @@ instance Applicative m => Applicative (IdentityT m) where {-# INLINE (<*>) #-} instance Monad m => Monad (IdentityT m) where - return x = IdentityT (return x) + return = pure {-# INLINE return #-} ma >>= mb = IdentityT $ runIdentityT ma >>= runIdentityT . mb {-# INLINE (>>=) #-} diff --git a/foundation/Foundation/Monad/Reader.hs b/foundation/Foundation/Monad/Reader.hs index b999ff2b..925ad43a 100644 --- a/foundation/Foundation/Monad/Reader.hs +++ b/foundation/Foundation/Monad/Reader.hs @@ -34,7 +34,7 @@ instance Applicative m => Applicative (ReaderT r m) where {-# INLINE (<*>) #-} instance Monad m => Monad (ReaderT r m) where - return a = ReaderT $ const (return a) + return = pure {-# INLINE return #-} ma >>= mab = ReaderT $ \r -> runReaderT ma r >>= \a -> runReaderT (mab a) r {-# INLINE (>>=) #-} diff --git a/foundation/Foundation/Monad/State.hs b/foundation/Foundation/Monad/State.hs index 2e4dad11..e7050ace 100644 --- a/foundation/Foundation/Monad/State.hs +++ b/foundation/Foundation/Monad/State.hs @@ -42,7 +42,7 @@ instance (Applicative m, Monad m) => Applicative (StateT s m) where {-# INLINE (<*>) #-} instance (Functor m, Monad m) => Monad (StateT s m) where - return a = StateT $ \s -> (,s) `fmap` return a + return = pure {-# INLINE return #-} ma >>= mab = StateT $ runStateT ma >=> (\(a, s2) -> runStateT (mab a) s2) {-# INLINE (>>=) #-} diff --git a/foundation/Foundation/Network/IPv4.hs b/foundation/Foundation/Network/IPv4.hs index 0325bbce..5e585647 100644 --- a/foundation/Foundation/Network/IPv4.hs +++ b/foundation/Foundation/Network/IPv4.hs @@ -12,6 +12,7 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} module Foundation.Network.IPv4 ( IPv4 diff --git a/foundation/Foundation/Network/IPv6.hs b/foundation/Foundation/Network/IPv6.hs index 0243e48f..e58dd90a 100644 --- a/foundation/Foundation/Network/IPv6.hs +++ b/foundation/Foundation/Network/IPv6.hs @@ -8,6 +8,7 @@ -- IPv6 data type -- {-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE TypeOperators #-} module Foundation.Network.IPv6 ( IPv6 @@ -28,7 +29,6 @@ import Numeric (readHex) import Foundation.Class.Storable import Foundation.Hashing.Hashable -import Basement.Numerical.Additive (scale) import Basement.Compat.Base import Data.Proxy import Foundation.Primitive diff --git a/foundation/Foundation/Parser.hs b/foundation/Foundation/Parser.hs index 74d2cb0e..d1077d24 100644 --- a/foundation/Foundation/Parser.hs +++ b/foundation/Foundation/Parser.hs @@ -24,6 +24,7 @@ {-# LANGUAGE Rank2Types #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE TypeOperators #-} module Foundation.Parser ( Parser diff --git a/foundation/Foundation/Random/DRG.hs b/foundation/Foundation/Random/DRG.hs index 46b98135..b380c02b 100644 --- a/foundation/Foundation/Random/DRG.hs +++ b/foundation/Foundation/Random/DRG.hs @@ -44,7 +44,7 @@ instance Applicative (MonadRandomState gen) where in (f a, g3) instance Monad (MonadRandomState gen) where - return a = MonadRandomState $ \g -> (a, g) + return = pure (>>=) m1 m2 = MonadRandomState $ \g1 -> let (a, g2) = runRandomState m1 g1 in runRandomState (m2 a) g2 diff --git a/foundation/Foundation/UUID.hs b/foundation/Foundation/UUID.hs index cdfed96d..c6a660e4 100644 --- a/foundation/Foundation/UUID.hs +++ b/foundation/Foundation/UUID.hs @@ -1,5 +1,6 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeOperators #-} module Foundation.UUID ( UUID(..) diff --git a/foundation/Foundation/VFS/FilePath.hs b/foundation/Foundation/VFS/FilePath.hs index a06ac295..a920d3d1 100644 --- a/foundation/Foundation/VFS/FilePath.hs +++ b/foundation/Foundation/VFS/FilePath.hs @@ -189,7 +189,6 @@ instance Semigroup FileName where (<>) (FileName a) (FileName b) = FileName $ a `mappend` b instance Monoid FileName where mempty = FileName mempty - mappend (FileName a) (FileName b) = FileName $ a `mappend` b instance Path FilePath where type PathEnt FilePath = FileName