diff --git a/ghc/lib/std/Directory.lhs b/ghc/lib/std/Directory.lhs index 263aeca7e4d6134be7d36d3a66f9b09e137e8a8f..fb76a2efefda6972d702bc6930f23809c0b7ff26 100644 --- a/ghc/lib/std/Directory.lhs +++ b/ghc/lib/std/Directory.lhs @@ -20,7 +20,12 @@ are relative to the current directory. {-# OPTIONS -#include <sys/stat.h> -#include <dirent.h> -#include "cbits/stgio.h" #-} module Directory ( - Permissions(Permissions,readable,writable,executable,searchable) + Permissions -- abstract + + , readable -- :: Permissions -> Bool + , writable -- :: Permissions -> Bool + , executable -- :: Permissions -> Bool + , searchable -- :: Permissions -> Bool , createDirectory -- :: FilePath -> IO () , removeDirectory -- :: FilePath -> IO () diff --git a/ghc/lib/std/Ix.lhs b/ghc/lib/std/Ix.lhs index 545c266f43bf72db729fa79fed1f0ba49a8627ae..5f121d85423984097bc6a1fec466a15e73cd6937 100644 --- a/ghc/lib/std/Ix.lhs +++ b/ghc/lib/std/Ix.lhs @@ -41,7 +41,7 @@ import PrelBase %********************************************************* \begin{code} -class ({-Show a,-} Ord a) => Ix a where +class (Ord a) => Ix a where range :: (a,a) -> [a] index :: (a,a) -> a -> Int inRange :: (a,a) -> a -> Bool @@ -56,16 +56,16 @@ class ({-Show a,-} Ord a) => Ix a where \begin{code} instance Ix Char where - range (c,c') - | c <= c' = [c..c'] + range (m,n) + | m <= n = [m..n] | otherwise = [] - index b@(c,_) ci - | inRange b ci = fromEnum ci - fromEnum c - | otherwise = indexError ci b "Char" + index b@(m,_) i + | inRange b i = fromEnum i - fromEnum m + | otherwise = indexError i b "Char" inRange (m,n) i = m <= i && i <= n instance Ix Int where - range (m,n) + range (m,n) | m <= n = [m..n] | otherwise = [] index b@(m,_) i diff --git a/ghc/lib/std/PrelArr.lhs b/ghc/lib/std/PrelArr.lhs index 4f4d89ef88748ec806e568af0392f5001796a42f..51508a352068ba7874928fe0a2a7725ba829783e 100644 --- a/ghc/lib/std/PrelArr.lhs +++ b/ghc/lib/std/PrelArr.lhs @@ -128,7 +128,7 @@ array ixs ivs = case (new_array_thing s) of { (# s#, arr@(MutableArray _ arr#) #) -> let fill_in s1# [] = s1# - fill_in s1# ((i,v):is) = + fill_in s1# ((i,v) : is) = case (index ixs i) of { I# n# -> case writeArray# arr# n# v s1# of { s2# -> fill_in s2# is }} diff --git a/ghc/lib/std/PrelBase.lhs b/ghc/lib/std/PrelBase.lhs index 1d6d69dbc78fa37fb3d33d2fb54c13f6b662877b..8ff06b7fe86359da4e516c75e0b6cebb7d0d3fbe 100644 --- a/ghc/lib/std/PrelBase.lhs +++ b/ghc/lib/std/PrelBase.lhs @@ -377,7 +377,7 @@ instance Enum Char where enumFrom (C# c) = efttCh (ord# c) 1# (># 255#) enumFromTo (C# c1) (C# c2) | c1 `leChar#` c2 = efttCh (ord# c1) 1# (># (ord# c2)) - | otherwise = efttCh (ord# c1) (negateInt# 1#) (<# (ord# c2)) + | otherwise = [] enumFromThen (C# c1) (C# c2) | c1 `leChar#` c2 = efttCh (ord# c1) (ord# c2 -# ord# c1) (># 255#) @@ -521,8 +521,8 @@ instance Enum Int where enumFrom (I# c) = efttInt True c 1# (\ _ -> False) enumFromTo (I# c1) (I# c2) - | c1 <# c2 = efttInt True c1 1# (># c2) - | otherwise = efttInt False c1 (negateInt# 1#) (<# c2) + | c1 <=# c2 = efttInt True c1 1# (># c2) + | otherwise = [] enumFromThen (I# c1) (I# c2) | c1 <# c2 = efttInt True c1 (c2 -# c1) (\ _ -> False) diff --git a/ghc/lib/std/PrelException.hi-boot b/ghc/lib/std/PrelException.hi-boot index 99cbf7995674f09c90e8ef2513dffd7f6cefe849..85561ba42abc27ce8a66b3e1b10d46f0eeab62dc 100644 --- a/ghc/lib/std/PrelException.hi-boot +++ b/ghc/lib/std/PrelException.hi-boot @@ -5,7 +5,7 @@ -- for PrelException.hi. --------------------------------------------------------------------------- -__interface PrelErr 1 where +__interface PrelException 1 where __export ! PrelException ioError catch; 1 ioError :: __forall [a] => PrelIOBase.IOError -> PrelIOBase.IO a ; 1 catch :: __forall [a] => PrelIOBase.IO a -> (PrelIOBase.IOError -> PrelIOBase.IO a) -> PrelIOBase.IO a ; diff --git a/ghc/lib/std/PrelNum.lhs b/ghc/lib/std/PrelNum.lhs index 08081353f35de6af763c98c4b3e2c8280058f10e..70e826c37a11609a72616292e8f2f526a716841d 100644 --- a/ghc/lib/std/PrelNum.lhs +++ b/ghc/lib/std/PrelNum.lhs @@ -276,7 +276,7 @@ instance Enum Integer where where en' a b = a : en' (a + b) b enumFromTo n m | n <= m = takeWhile (<= m) (enumFrom n) - | otherwise = takeWhile (>= m) (enumFromThen n (n-1)) + | otherwise = [] enumFromThenTo n m p = takeWhile pred (enumFromThen n m) where pred | m >= n = (<= p) diff --git a/ghc/lib/std/PrelNumExtra.lhs b/ghc/lib/std/PrelNumExtra.lhs index 8322e260de1a5532c9c4b08f531f69cf1dc6300f..265f76cafaedefe53b406b8e7542cfe25684eaec 100644 --- a/ghc/lib/std/PrelNumExtra.lhs +++ b/ghc/lib/std/PrelNumExtra.lhs @@ -394,6 +394,7 @@ instance Enum Double where toEnum = fromIntegral fromEnum = fromInteger . truncate -- may overflow enumFrom = numericEnumFrom + enumFromTo = numericEnumFromTo enumFromThen = numericEnumFromThen enumFromThenTo = numericEnumFromThenTo diff --git a/ghc/lib/std/Prelude.lhs b/ghc/lib/std/Prelude.lhs index 236558c35ee2c379ce63f63e5efa10a93a716cbd..6ba2bd55e6e40d3ac408b5b34a72963e5f9a03e7 100644 --- a/ghc/lib/std/Prelude.lhs +++ b/ghc/lib/std/Prelude.lhs @@ -29,7 +29,7 @@ module Prelude ( Either(..), Ordering(..), Char, String, Int, Integer, Float, Double, IO, - Ratio, Rational, + Rational, []((:), []), module PrelTup,