[project @ 1999-02-01 10:02:15 by sof]
authorsof <unknown>
Mon, 1 Feb 1999 10:02:18 +0000 (10:02 +0000)
committersof <unknown>
Mon, 1 Feb 1999 10:02:18 +0000 (10:02 +0000)
H98 Prelude tweaks

ghc/lib/std/Directory.lhs
ghc/lib/std/Ix.lhs
ghc/lib/std/PrelArr.lhs
ghc/lib/std/PrelBase.lhs
ghc/lib/std/PrelException.hi-boot
ghc/lib/std/PrelNum.lhs
ghc/lib/std/PrelNumExtra.lhs
ghc/lib/std/Prelude.lhs

index 263aeca..fb76a2e 100644 (file)
@@ -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 ()
index 545c266..5f121d8 100644 (file)
@@ -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
index 4f4d89e..51508a3 100644 (file)
@@ -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 }}
index 1d6d69d..8ff06b7 100644 (file)
@@ -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)
index 99cbf79..85561ba 100644 (file)
@@ -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 ;
index 0808135..70e826c 100644 (file)
@@ -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)
index 8322e26..265f76c 100644 (file)
@@ -394,6 +394,7 @@ instance  Enum Double  where
     toEnum         =  fromIntegral
     fromEnum       =  fromInteger . truncate   -- may overflow
     enumFrom      =  numericEnumFrom
+    enumFromTo     =  numericEnumFromTo
     enumFromThen   =  numericEnumFromThen
     enumFromThenTo =  numericEnumFromThenTo
 
index 236558c..6ba2bd5 100644 (file)
@@ -29,7 +29,7 @@ module Prelude (
     Either(..),
     Ordering(..), 
     Char, String, Int, Integer, Float, Double, IO,
-    Ratio, Rational, 
+    Rational,
     []((:), []),
     
     module PrelTup,