Changes between Version 19 and Version 20 of TypeNats/Basics


Ignore:
Timestamp:
Jan 31, 2011 4:46:47 PM (5 years ago)
Author:
diatchki
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TypeNats/Basics

    v19 v20  
    9696When defining `memset` we can just use `natToInteger` on the `Nat n` parameter to get the actual value of the array size.
    9797
    98 Another approach is to let the system infer the parameter by using the class `TypeNat`.  For example:
     98Another approach is to let the system infer the parameter by using the class `NatI`.  For example:
    9999{{{
    100100memsetAuto :: (Storable a, NatI n) => ArrPtr n a -> a -> IO ()
     
    103103In this style, the caller of the function does not need to provide the size of the array explicitly.
    104104Instead, it is computed automatically from the type of the array.
    105 When defining `memsetAuto` we can use `nat`, the method of `TypeNat`, to get access to the value corresponding to the type level natural.
     105When defining `memsetAuto` we can use `nat`, the method of `NatI`, to get access to the value corresponding to the type level natural.
    106106
    107107When using the implicit style, it is important that the type of `nat` is specified precisely.  Failing to do so typically results in ambiguity errors