summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore/should_compile/T23012.hs
blob: 7b0a42cac303b427ef7d6024f7d0a9eb6e8b9f15 (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
{-# LANGUAGE BangPatterns, FlexibleInstances, MultiParamTypeClasses #-}

module T23012 where

import Data.Kind (Type)

class Vector v a where
  nothing :: v a
  just :: a -> v a

data Proxy (a :: Type) = P

instance Vector Proxy a where
  nothing = P
  just _ = P

step :: Maybe a
step = Nothing
{-# INLINE[0] step #-}

stream :: Vector v a => v a
stream = case step of
           Nothing -> nothing
           Just !x -> just x
{-# INLINE[1] stream #-}

data Id a = MkId a

f :: (Proxy (Id a), Proxy a)
f = (stream, stream)