Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/prelude/Ix/Ix_2.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


module Ix(Ix(..)) where

import CIx

instance  (Ix a, Ix b)  => Ix (a,b) where
         range ((l,l'),(u,u'))
                 = [(i,i') | i <- range (l,u), i' <- range (l',u')]
         index ((l,l'),(u,u')) (i,i')
                 =  index (l,u) i * rangeSize (l',u') + index (l',u') i'
         inRange ((l,l'),(u,u')) (i,i')
                 = inRange (l,u) i && inRange (l',u') i'


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.