papa-0.7.0: test/ComposesUnsafe.hs
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -Wall #-}
{- HLINT ignore "Avoid restricted function" -}
{- HLINT ignore "Evaluate" -}
-- Reason: this module uses Papa.Unsafe's partial functions, without
-- evaluating them, and Papa's total
-- maximum, so that each name must resolve.
-- | "Papa.Unsafe" is "Papa" with every partial function, and imports on its
-- own: this module compiles only if no name it exports is ambiguous where it
-- is used.
module ComposesUnsafe (
composesUnsafe,
) where
import Papa.Unsafe
-- | Partial functions and "Papa"'s names, each used once.
composesUnsafe :: [String]
composesUnsafe =
[ show (7 `div` (2 :: Int), 7 `mod` (2 :: Int), divMod 7 (2 :: Int), quot 7 (2 :: Int), rem 7 (2 :: Int), quotRem 7 (2 :: Int))
, show ((2 :: Int) ^ (3 :: Int), (1 :: Double) / 2, recip (2 :: Double), (2 :: Double) ^^ (-1 :: Int), 1 % (2 :: Integer))
, show (fromIntegral (3 :: Int) :: Integer, intCast (3 :: Int) :: Integer)
, printf "%d" (1 :: Int)
, show (maximum (1 :| [2 :: Int]), fmap (divNonZero 7) (preview nonZero (2 :: Int)), the _1 ('a', ()))
, show (const () (throw Overflow :: ()), const () (error "e" :: ()), const () (errorWithoutStackTrace "e" :: ()), const () (undefined :: ()), const () (throwing _ArithException Overflow :: ()), const () (throwing_ _Overflow :: Maybe ()))
]