summaryrefslogtreecommitdiff
path: root/examples/experiments/listlike.hs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/experiments/listlike.hs')
-rw-r--r--examples/experiments/listlike.hs24
1 files changed, 0 insertions, 24 deletions
diff --git a/examples/experiments/listlike.hs b/examples/experiments/listlike.hs
deleted file mode 100644
index 2d62447..0000000
--- a/examples/experiments/listlike.hs
+++ /dev/null
@@ -1,24 +0,0 @@
1{-# OPTIONS_GHC -fglasgow-exts #-}
2
3import qualified Data.ListLike as LL
4import Numeric.LinearAlgebra
5import Data.Monoid
6import Foreign
7
8instance Storable a => LL.FoldableLL (Vector a) a where
9 foldl f x v = foldl f x (toList v)
10 foldr f x v = foldr f x (toList v)
11
12instance Storable a => LL.ListLike (Vector a) a where
13 singleton a = fromList [a]
14 head a = a @> 0
15 tail a | dim a == 1 = mempty
16 | otherwise = subVector 1 (dim a -1) a
17 genericLength = fromIntegral.dim
18
19
20v k = fromList [1..k] :: Vector Double
21
22f k = k+(3::Double)
23
24main = print $ (LL.map f [1..5] :: Vector Double) \ No newline at end of file