summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci/should_run/T13825-ghci.hs
blob: 959cc7dc5b9e1e5e4243e957ee3b17d63162984e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module T13825 where

import Data.Int
import Data.Word

data Packed =
    Packed
      {-# UNPACK #-} !Float
      {-# UNPACK #-} !Float
      {-# UNPACK #-} !Int8
      {-# UNPACK #-} !Word16
      {-# UNPACK #-} !Float
      {-# UNPACK #-} !Int
  deriving (Show)

-- Test a top-level constant
packed :: Packed
packed = Packed 1.0 2.0 3 4 5 6

packedAll :: [Packed]
packedAll =
    packed :
    [ Packed
        (fromIntegral i)
        (fromIntegral (i + 1))
        (fromIntegral (i + 2))
        (fromIntegral (i + 3))
        (fromIntegral (i + 3))
        (fromIntegral (i + 4))
    | i <- [1.. 4]
    ]

addOne :: Packed -> Packed
addOne (Packed a b c d e f) =
    Packed (a + 1.0) (b + 1.0) (c + 1) (d + 1) (e + 1.0) (f + 1)

mapAddOne :: [Packed] -> [Packed]
mapAddOne = map addOne