summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving/should_compile/T8138.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/deriving/should_compile/T8138.hs')
-rw-r--r--testsuite/tests/deriving/should_compile/T8138.hs48
1 files changed, 0 insertions, 48 deletions
diff --git a/testsuite/tests/deriving/should_compile/T8138.hs b/testsuite/tests/deriving/should_compile/T8138.hs
deleted file mode 100644
index e6d9781a7a..0000000000
--- a/testsuite/tests/deriving/should_compile/T8138.hs
+++ /dev/null
@@ -1,48 +0,0 @@
-{-# LANGUAGE ScopedTypeVariables #-}
-
-module Main where
-
-import Control.Monad.ST
-import Data.Primitive
-
-main :: IO ()
-main = do
- let xs :: [Float] = runST $ do
- barr <- mutableByteArrayFromList [1..fromIntegral n::Float]
- peekByteArray n barr
- print xs
- where
- n = 13
-
-mutableByteArrayFromList :: forall s a . (Prim a)
- => [a]
- -> ST s (MutableByteArray s)
-mutableByteArrayFromList xs = do
- arr <- newByteArray (length xs*sizeOf (undefined :: a))
- loop arr 0 xs
- return arr
- where
- loop :: MutableByteArray s -> Int -> [a] -> ST s ()
- loop _ _ [] = return ()
-
- loop arr i (x : xs) = do
- writeByteArray arr i x
- loop arr (i+1) xs
-
-peekByteArray :: (Prim a)
- => Int
- -> MutableByteArray s
- -> ST s [a]
-peekByteArray n arr =
- loop 0 arr
- where
- loop :: (Prim a)
- => Int
- -> MutableByteArray s
- -> ST s [a]
- loop i _ | i >= n = return []
-
- loop i arr = do
- x <- readByteArray arr i
- xs <- loop (i+1) arr
- return (x : xs)