Commit b8f58392 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺
Browse files

Export `Monoid(..)`/`Foldable(..)`/`Traversable(..)` from Prelude

This finally exposes also the methods of these 3 classes in the Prelude
in order to allow to define basic class instances w/o needing imports.

This almost completes the primary goal of #9586

NOTE: `fold`, `foldl'`, `foldr'`, and `toList` are not exposed yet,
      as they require upstream fixes for at least `containers` and
      `bytestring`, and are not required for defining basic instances.

Reviewed By: ekmett, austin

Differential Revision: https://phabricator.haskell.org/D236
parent 1f7f46f9
......@@ -5,6 +5,7 @@ instance Eq () -- Defined in ‘GHC.Classes’
instance Ord () -- Defined in ‘GHC.Classes’
instance Read () -- Defined in ‘GHC.Read’
instance Show () -- Defined in ‘GHC.Show’
instance Monoid () -- Defined in ‘GHC.Base’
data (##) = (##) -- Defined in ‘GHC.Prim’
() :: ()
(##) :: (# #)
......@@ -18,10 +19,11 @@ instance Functor ((,) a) -- Defined in ‘GHC.Base’
instance (Ord a, Ord b) => Ord (a, b) -- Defined in ‘GHC.Classes’
instance (Read a, Read b) => Read (a, b) -- Defined in ‘GHC.Read’
instance (Show a, Show b) => Show (a, b) -- Defined in ‘GHC.Show’
instance GHC.Base.Monoid a => Applicative ((,) a)
-- Defined in ‘GHC.Base’
instance Monoid a => Applicative ((,) a) -- Defined in ‘GHC.Base’
instance Foldable ((,) a) -- Defined in ‘Data.Foldable’
instance Traversable ((,) a) -- Defined in ‘Data.Traversable’
instance (Monoid a, Monoid b) => Monoid (a, b)
-- Defined in ‘GHC.Base’
data (#,#) (a :: OpenKind) (b :: OpenKind) = (#,#) a b
-- Defined in ‘GHC.Prim’
(,) :: a -> b -> (a, b)
......
......@@ -8,6 +8,7 @@ instance Show a => Show [a] -- Defined in ‘GHC.Show’
instance Applicative [] -- Defined in ‘GHC.Base’
instance Foldable [] -- Defined in ‘Data.Foldable’
instance Traversable [] -- Defined in ‘Data.Traversable’
instance Monoid [a] -- Defined in ‘GHC.Base’
data () = () -- Defined in ‘GHC.Tuple’
instance Bounded () -- Defined in ‘GHC.Enum’
instance Enum () -- Defined in ‘GHC.Enum’
......@@ -15,6 +16,7 @@ instance Eq () -- Defined in ‘GHC.Classes’
instance Ord () -- Defined in ‘GHC.Classes’
instance Read () -- Defined in ‘GHC.Read’
instance Show () -- Defined in ‘GHC.Show’
instance Monoid () -- Defined in ‘GHC.Base’
data (,) a b = (,) a b -- Defined in ‘GHC.Tuple’
instance (Bounded a, Bounded b) => Bounded (a, b)
-- Defined in ‘GHC.Enum’
......@@ -23,7 +25,8 @@ instance Functor ((,) a) -- Defined in ‘GHC.Base’
instance (Ord a, Ord b) => Ord (a, b) -- Defined in ‘GHC.Classes’
instance (Read a, Read b) => Read (a, b) -- Defined in ‘GHC.Read’
instance (Show a, Show b) => Show (a, b) -- Defined in ‘GHC.Show’
instance GHC.Base.Monoid a => Applicative ((,) a)
-- Defined in ‘GHC.Base’
instance Monoid a => Applicative ((,) a) -- Defined in ‘GHC.Base’
instance Foldable ((,) a) -- Defined in ‘Data.Foldable’
instance Traversable ((,) a) -- Defined in ‘Data.Traversable’
instance (Monoid a, Monoid b) => Monoid (a, b)
-- Defined in ‘GHC.Base’
......@@ -2,3 +2,4 @@ data (->) a b -- Defined in ‘GHC.Prim’
instance Monad ((->) r) -- Defined in ‘GHC.Base’
instance Functor ((->) r) -- Defined in ‘GHC.Base’
instance Applicative ((->) a) -- Defined in ‘GHC.Base’
instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’
......@@ -5,6 +5,7 @@ module Main(main) where
import Control.Monad.Fix
import Control.Monad.ST
import Data.STRef
import Prelude hiding (traverse)
newtype Node s a = N (STRef s Bool, Node s a, a, Node s a)
......
......@@ -15,6 +15,7 @@ import Control.Monad
import Control.Monad.Trans.State
import Data.List
import Data.Ord
import Prelude hiding (traverse)
type Traverse a = State (SrcSpan, [(Name, SrcSpan)]) a
......
......@@ -2,6 +2,7 @@
module DfltProb1 where
import Control.Monad.ST
import Prelude hiding (traverse)
traverse :: a -> ST s [a]
traverse = undefined
......
......@@ -17,7 +17,6 @@ import System.IO (localeEncoding)
import Data.List
import Data.Maybe(fromJust)
import Data.Array
import Data.Monoid
import Control.Monad
import qualified Data.Set as Set
......
......@@ -19,7 +19,6 @@
module Main (main) where
import Control.Exception
import Data.Monoid
import System.Directory
import System.Environment
import System.Exit
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment