thebigdir > References > Haskell reference
| Indexes | Syntax | Prelude | Ratio | Complex | Numeric | >> Ix << | Array | List | Maybe | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | Random

Ix

The Ix class is used to map a continuous subrange of values in a type onto integers.
module Ix ( Ix(range, index, inRange), rangeSize ) where

class  (Ord a) => Ix a  where
    range               :: (a,a) -> [a]
    index               :: (a,a) -> a -> Int
    inRange             :: (a,a) -> a -> Bool

rangeSize :: Ix a => (a,a) -> Int
rangeSize b@(l,h) | null (range b) = 0
                  | otherwise      = index b h + 1 
-- NB: replacing "null (range b)" by  "l > h" fails if
-- the bounds are tuples.  For example,
--  (2,1) > (1,2), 
-- but 
-- range ((2,1),(1,2)) = []


instance  Ix Char  where
    range (m,n) = [m..n]
    index b@(c,c') ci
        | inRange b ci  =  fromEnum ci - fromEnum c
        | otherwise     =  error "Ix.index: Index out of range."
    inRange (c,c') i    =  c <= i && i <= c'

instance  Ix Int  where
    range (m,n) = [m..n]
    index b@(m,n) i
        | inRange b i   =  i - m
        | otherwise     =  error "Ix.index: Index out of range."
    inRange (m,n) i     =  m <= i && i <= n

instance  Ix Integer  where
    range (m,n) = [m..n]
    index b@(m,n) i
        | inRange b i   =  fromInteger (i - m)
        | otherwise     =  error "Ix.index: Index out of range."
    inRange (m,n) i     =  m <= i && i <= n

instance (Ix a,Ix b) => Ix (a, b) -- as derived, for all tuples
instance Ix Bool                  -- as derived
instance Ix Ordering              -- as derived
instance Ix ()                    -- as derived




Partner sites:

 

visit Quiksilver Surf Camps and Surf School and book a surf lesson.

And for the girls you can visit this site Roxy Surf Camps and Surfing School to learn more about surfing and take a class as well.

 

If you want to see a good surf contest visit this site: Billabong Pro Pipeline Masters Surfing Contest 2007. You'll be glad you did.

Billabong Pro Pipe Pipeline Masters 2007 Surf Contest This website is one that you have to see at boardshort superstore quiksilver billabong swim suit hurley roxy quicksilver volcom

 

This is a must go surfing event: Eddie Would Go Aikau Big Wave Invitational 2007 Quiksilver Surf fans from around the world will be watching this event and buying the Eddie Would Go Surf Clothing.

 

 

Check out these online surf shop websites. I like the BOARDSHORTSUPERSTORE.COM website the best but there are others. There is also the BUYBOARDSHORTS.COM website that has a good selection as well. And if you want to see a great selection of shirts, BUYSURFTEES.COM is a good site and I think each one of the websites has a great selection.