summaryrefslogtreecommitdiff
path: root/testsuite/tests/linear/should_compile/Linear16.hs
blob: 8ed8b5b36c0704bf2aa6c098db369a338b7887e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# LANGUAGE LinearTypes #-}
{-# LANGUAGE UnicodeSyntax #-}
{-# LANGUAGE RebindableSyntax #-}
module Linear16 where

-- Rebindable do notation

(>>=) :: a ⊸ (a ⊸ b) ⊸ b
(>>=) x f = f x

-- `fail` is needed due to pattern matching on ();
-- ideally, it shouldn't be there.
fail :: a
fail = fail

correctDo = do
  x <- ()
  (y,z) <- ((),x)
  () <- y
  () <- z
  ()