Commit 67840816 authored by dreixel's avatar dreixel
Browse files

Merge branch 'master' of http://darcs.haskell.org/testsuite into ghc-generics

parents 27e2c656 e54809c4
{-# LANGUAGE BangPatterns #-}
module Main where
import Data.Array.Base (unsafeRead, unsafeWrite)
import Data.Array.ST
import Data.Array.Unboxed
import Control.Monad.ST
main = print (divisorCounts 1000000 ! 342)
isqrt :: Int -> Int
isqrt n = floor (sqrt $ fromIntegral n)
divisorCounts :: Int -> UArray Int Int
divisorCounts n = runSTUArray $ do
let !rt = isqrt n
darr <- newArray (0,n) 1 :: ST s (STUArray s Int Int)
let inc i = unsafeRead darr i >>= \k -> unsafeWrite darr i (k+1)
note step i
| i > n = return ()
| otherwise = do
inc i
note step (i+step)
count j
| j > rt = return ()
| otherwise = do
note (2*j) (j*j)
count (j+2)
note 2 4
count 3
return darr
......@@ -107,3 +107,11 @@ test('T149',
run_command,
['$MAKE -s --no-print-directory T149'])
test('T5113',
[stats_num_field('bytes allocated', 8000000,
9000000),
only_ways(['normal'])
],
compile_and_run,
['-O'])
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module Test where
class C t where
type TF t
ttt :: TF t -> t
b :: (C t, ?x :: TF t) => t
b = ttt ?x
......@@ -342,3 +342,4 @@ test('T4912', extra_clean(['T4912a.hi', 'T4912a.o']),
test('T4952', normal, compile, [''])
test('T4969', normal, compile, [''])
test('T5120', normal, compile, [''])
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment