-- | Unsafe variants of monadic functions.
module Sound.Sc3.Common.Unsafe where

import System.IO.Unsafe {- base -}

-- * Lift

-- | Lift monadic r to unsafe form.
liftUnsafe0 :: (IO r) -> (x -> r)
liftUnsafe0 :: forall r x. IO r -> x -> r
liftUnsafe0 IO r
fn x
_ = IO r -> r
forall a. IO a -> a
unsafePerformIO IO r
fn

-- | Lift monadic r to unsafe form.
liftUnsafe1 :: (a -> IO r) -> (a -> r)
liftUnsafe1 :: forall a r. (a -> IO r) -> a -> r
liftUnsafe1 a -> IO r
fn = IO r -> r
forall a. IO a -> a
unsafePerformIO (IO r -> r) -> (a -> IO r) -> a -> r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> IO r
fn

-- | Lift monadic r to unsafe form.
liftUnsafe2 :: (a -> b -> IO r) -> (a -> b -> r)
liftUnsafe2 :: forall a b r. (a -> b -> IO r) -> a -> b -> r
liftUnsafe2 a -> b -> IO r
fn a
a = IO r -> r
forall a. IO a -> a
unsafePerformIO (IO r -> r) -> (b -> IO r) -> b -> r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b -> IO r
fn a
a

-- | Lift monadic r to unsafe form.
liftUnsafe3 :: (a -> b -> c -> IO r) -> (a -> b -> c -> r)
liftUnsafe3 :: forall a b c r. (a -> b -> c -> IO r) -> a -> b -> c -> r
liftUnsafe3 a -> b -> c -> IO r
fn a
a b
b = IO r -> r
forall a. IO a -> a
unsafePerformIO (IO r -> r) -> (c -> IO r) -> c -> r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b -> c -> IO r
fn a
a b
b

-- | Lift monadic r to unsafe form.
liftUnsafe4 :: (a -> b -> c -> d -> IO r) -> (a -> b -> c -> d -> r)
liftUnsafe4 :: forall a b c d r.
(a -> b -> c -> d -> IO r) -> a -> b -> c -> d -> r
liftUnsafe4 a -> b -> c -> d -> IO r
fn a
a b
b c
c = IO r -> r
forall a. IO a -> a
unsafePerformIO (IO r -> r) -> (d -> IO r) -> d -> r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b -> c -> d -> IO r
fn a
a b
b c
c

-- | Lift monadic r to unsafe form.
liftUnsafe5 :: (a -> b -> c -> d -> e -> IO r) -> (a -> b -> c -> d -> e -> r)
liftUnsafe5 :: forall a b c d e r.
(a -> b -> c -> d -> e -> IO r) -> a -> b -> c -> d -> e -> r
liftUnsafe5 a -> b -> c -> d -> e -> IO r
fn a
a b
b c
c d
d = IO r -> r
forall a. IO a -> a
unsafePerformIO (IO r -> r) -> (e -> IO r) -> e -> r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b -> c -> d -> e -> IO r
fn a
a b
b c
c d
d

-- | Lift monadic r to unsafe form.
liftUnsafe6 :: (a -> b -> c -> d -> e -> f -> IO r) -> (a -> b -> c -> d -> e -> f -> r)
liftUnsafe6 :: forall a b c d e f r.
(a -> b -> c -> d -> e -> f -> IO r)
-> a -> b -> c -> d -> e -> f -> r
liftUnsafe6 a -> b -> c -> d -> e -> f -> IO r
fn a
a b
b c
c d
d e
e = IO r -> r
forall a. IO a -> a
unsafePerformIO (IO r -> r) -> (f -> IO r) -> f -> r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b -> c -> d -> e -> f -> IO r
fn a
a b
b c
c d
d e
e

-- | Lift monadic r to unsafe form.
liftUnsafe7 :: (a -> b -> c -> d -> e -> f -> g -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> r)
liftUnsafe7 :: forall a b c d e f g r.
(a -> b -> c -> d -> e -> f -> g -> IO r)
-> a -> b -> c -> d -> e -> f -> g -> r
liftUnsafe7 a -> b -> c -> d -> e -> f -> g -> IO r
fn a
a b
b c
c d
d e
e f
f = IO r -> r
forall a. IO a -> a
unsafePerformIO (IO r -> r) -> (g -> IO r) -> g -> r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b -> c -> d -> e -> f -> g -> IO r
fn a
a b
b c
c d
d e
e f
f

-- | Lift monadic r to unsafe form.
liftUnsafe8 :: (a -> b -> c -> d -> e -> f -> g -> h -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> r)
liftUnsafe8 :: forall a b c d e f g h r.
(a -> b -> c -> d -> e -> f -> g -> h -> IO r)
-> a -> b -> c -> d -> e -> f -> g -> h -> r
liftUnsafe8 a -> b -> c -> d -> e -> f -> g -> h -> IO r
fn a
a b
b c
c d
d e
e f
f g
g = IO r -> r
forall a. IO a -> a
unsafePerformIO (IO r -> r) -> (h -> IO r) -> h -> r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b -> c -> d -> e -> f -> g -> h -> IO r
fn a
a b
b c
c d
d e
e f
f g
g

-- | Lift monadic r to unsafe form.
liftUnsafe9 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> r)
liftUnsafe9 :: forall a b c d e f g h i r.
(a -> b -> c -> d -> e -> f -> g -> h -> i -> IO r)
-> a -> b -> c -> d -> e -> f -> g -> h -> i -> r
liftUnsafe9 a -> b -> c -> d -> e -> f -> g -> h -> i -> IO r
fn a
a b
b c
c d
d e
e f
f g
g h
h = IO r -> r
forall a. IO a -> a
unsafePerformIO (IO r -> r) -> (i -> IO r) -> i -> r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b -> c -> d -> e -> f -> g -> h -> i -> IO r
fn a
a b
b c
c d
d e
e f
f g
g h
h

-- | Lift monadic r to unsafe form.
liftUnsafe10 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> r)
liftUnsafe10 :: forall a b c d e f g h i j r.
(a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> IO r)
-> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> r
liftUnsafe10 a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> IO r
fn a
a b
b c
c d
d e
e f
f g
g h
h i
i = IO r -> r
forall a. IO a -> a
unsafePerformIO (IO r -> r) -> (j -> IO r) -> j -> r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> IO r
fn a
a b
b c
c d
d e
e f
f g
g h
h i
i

-- | Lift monadic r to unsafe form.
liftUnsafe11 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> r)
liftUnsafe11 :: forall a b c d e f g h i j k r.
(a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> IO r)
-> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> r
liftUnsafe11 a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> IO r
fn a
a b
b c
c d
d e
e f
f g
g h
h i
i j
j = IO r -> r
forall a. IO a -> a
unsafePerformIO (IO r -> r) -> (k -> IO r) -> k -> r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> IO r
fn a
a b
b c
c d
d e
e f
f g
g h
h i
i j
j

-- | Lift monadic r to unsafe form.
liftUnsafe12 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> r)
liftUnsafe12 :: forall a b c d e f g h i j k l r.
(a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> IO r)
-> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> r
liftUnsafe12 a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> IO r
fn a
a b
b c
c d
d e
e f
f g
g h
h i
i j
j k
k = IO r -> r
forall a. IO a -> a
unsafePerformIO (IO r -> r) -> (l -> IO r) -> l -> r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> IO r
fn a
a b
b c
c d
d e
e f
f g
g h
h i
i j
j k
k