-- | 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
_ = 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 = forall a. IO a -> a
unsafePerformIO 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 = forall a. IO a -> a
unsafePerformIO 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 = forall a. IO a -> a
unsafePerformIO 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 = forall a. IO a -> a
unsafePerformIO 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 = forall a. IO a -> a
unsafePerformIO 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 = forall a. IO a -> a
unsafePerformIO 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 = forall a. IO a -> a
unsafePerformIO 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 = forall a. IO a -> a
unsafePerformIO 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 = forall a. IO a -> a
unsafePerformIO 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 = forall a. IO a -> a
unsafePerformIO 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 = forall a. IO a -> a
unsafePerformIO 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 = forall a. IO a -> a
unsafePerformIO 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