Changes between Version 17 and Version 18 of TypeNats/Basics


Ignore:
Timestamp:
Jan 31, 2011 9:32:06 AM (3 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TypeNats/Basics

    v17 v18  
    9191Another approach is to let the system infer the parameter by using the class `TypeNat`.  For example: 
    9292{{{ 
    93 memsetAuto :: (Storable a, TypeNat n) => ArrPtr n a -> a -> IO () 
     93memsetAuto :: (Storable a, NatI n) => ArrPtr n a -> a -> IO () 
    9494}}} 
    9595 
    96 In this style, the caller of the function does not need to provide the type of the array explicitly. 
     96In this style, the caller of the function does not need to provide the size of the array explicitly. 
    9797Instead, it is computed automatically from the type of the array. 
    9898When defining `memsetAuto` we can use `nat`, the method of `TypeNat`, to get access to the value corresponding to the type level natural.