1. Thijs Alkemade
  2. haskell-unittyped

Commits

Takayuki Muranushi  committed c7891c4

dimensional computation now possible over arrays.

  • Participants
  • Parent commits 8433b78
  • Branches default

Comments (0)

Files changed (2)

File src/UnitTyped.hs

View file
  • Ignore whitespace
 val :: Value a b f -> f
 val (Value f) = f
 
+deriving instance (Eq f) => Eq (Value a b f)
+
 instance Functor (Value a b) where
     fmap f = mkVal . f . val
 

File tests/TestUnbox.hs

View file
  • Ignore whitespace
 {-# LANGUAGE KindSignatures, DataKinds, MultiParamTypeClasses, FunctionalDependencies, ExistentialQuantification, TypeFamilies #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving #-}
+
 module Main where
 
 import UnitTyped
 import Control.Monad (foldM, unless)
 import Data.Ratio
 import qualified Data.Array.Repa as Repa
+import qualified Data.Array.Repa.Eval as Repa
 import qualified Data.Vector as V
 import qualified Data.Vector.Unboxed as VU
 import Prelude (zip, show, (++), IO, Bool(..), Integer, Double, return, error, putStrLn, fromIntegral)
 rux2d :: Repa.Array Repa.U Repa.DIM1 DoubleMeter
 rux2d = Repa.fromUnboxed (Repa.ix1 100) vux2d
 
-t2 = (Repa.sumAllS rux2d) == 4950
+t2 = (Repa.foldAllS (|+|) (0*| meter) rux2d) Prelude.== 4950 *| meter
+
+deriving instance Repa.Elt f => Repa.Elt (Value a b f)
 
 runTest :: Bool -> (Bool, Integer) -> IO Bool
 runTest b (True, _) = return b