packages feed

papa-0.7.0: test/Deny.hs

{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -Wall #-}

{- HLINT ignore "Avoid restricted function" -}
-- Reason: every restricted name here is this module's own binding of type (),
-- defined so that its use is ambiguous were Papa to export the name.

-- | The names that 'Papa' must not export: partial functions, functions that
-- return garbage or silently lose information, and lazy or throwing I/O.
--
-- This module defines each name itself and uses it unqualified. Were 'Papa' to
-- export one of them, the use would be ambiguous and this module, and so the
-- test suite, would not compile. That is the test.
--
-- Names that 'Papa' reuses for a total function (@head@, @succ@, @cycle@,
-- @readFile@, …) are not here: "Totals" pins their total types instead.
module Deny (
  denied,
  deniedTypes,
) where

import Papa

-- | Every denied name, used unqualified.
--
-- 'NonEmpty' and ':|' are 'Papa''s: a use of the import, without which it
-- would be unused (every other name here is this module's own).
denied :: NonEmpty ()
denied =
  error
    :| [ -- base: errors and partial functions
         errorWithoutStackTrace
       , undefined
       , throw
       , fromJust
       , read
       , toEnum
       , fromEnum
       , foldr1
       , foldl1
       , foldl1'
       , genericIndex
       , getEnv
       , -- base: numeric functions that throw, wrap or return garbage
         fromIntegral
       , fromInteger
       , approxRational
       , realToFrac
       , truncate
       , round
       , ceiling
       , floor
       , properFraction
       , toRational
       , div
       , mod
       , divMod
       , quot
       , rem
       , quotRem
       , (/)
       , recip
       , (^)
       , (^^)
       , (%)
       , -- base: unsafe, debugging and formatting
         unsafePerformIO
       , unsafeDupablePerformIO
       , unsafeInterleaveIO
       , unsafeCoerce
       , trace
       , traceShow
       , printf
       , hPrintf
       , fail
       , -- base: leaky
         modifyIORef
       , atomicModifyIORef
       , -- semigroupoids and base classes with partial instances
         zero
       , mfix
       , -- lens: partial combinators
         (^?!)
       , (^@?!)
       , foldr1Of
       , foldl1Of
       , foldr1Of'
       , foldl1Of'
       , singular
       , unsafeSingular
       , unsafePartsOf
       , unsafePartsOf'
       , iunsafePartsOf
       , iunsafePartsOf'
       , throwing
       , throwing_
       , -- base: String I/O that throws
         putChar
       , hGetChar
       , readLn
       , -- containers
         (!)
       , -- async: rethrow a thread's exception in another
         wait
       , waitAny
       , waitEither
       , waitBoth
       , link
       , link2
       , -- directory: deprecated, or with . and ..
         getDirectoryContents
       , isSymbolicLink
       ]

-- | Every denied type, used unqualified: a type of base whose arithmetic
-- throws ('Numeric.Natural.Natural') or wraps around at a bounded type
-- ('Data.Ratio.Ratio').
deniedTypes :: (Natural, Ratio Int)
deniedTypes =
  ((), ())

type Natural = ()

type Ratio a = ()

error :: ()
error = ()

errorWithoutStackTrace :: ()
errorWithoutStackTrace = ()

undefined :: ()
undefined = ()

throw :: ()
throw = ()

fromJust :: ()
fromJust = ()

read :: ()
read = ()

toEnum :: ()
toEnum = ()

fromEnum :: ()
fromEnum = ()

foldr1 :: ()
foldr1 = ()

foldl1 :: ()
foldl1 = ()

foldl1' :: ()
foldl1' = ()

genericIndex :: ()
genericIndex = ()

getEnv :: ()
getEnv = ()

fromIntegral :: ()
fromIntegral = ()

realToFrac :: ()
realToFrac = ()

fromInteger :: ()
fromInteger = ()

approxRational :: ()
approxRational = ()

truncate :: ()
truncate = ()

round :: ()
round = ()

ceiling :: ()
ceiling = ()

floor :: ()
floor = ()

properFraction :: ()
properFraction = ()

toRational :: ()
toRational = ()

div :: ()
div = ()

mod :: ()
mod = ()

divMod :: ()
divMod = ()

quot :: ()
quot = ()

rem :: ()
rem = ()

quotRem :: ()
quotRem = ()

(/) :: ()
(/) = ()

recip :: ()
recip = ()

(^) :: ()
(^) = ()

(^^) :: ()
(^^) = ()

(%) :: ()
(%) = ()

unsafePerformIO :: ()
unsafePerformIO = ()

unsafeDupablePerformIO :: ()
unsafeDupablePerformIO = ()

unsafeInterleaveIO :: ()
unsafeInterleaveIO = ()

unsafeCoerce :: ()
unsafeCoerce = ()

trace :: ()
trace = ()

traceShow :: ()
traceShow = ()

printf :: ()
printf = ()

hPrintf :: ()
hPrintf = ()

fail :: ()
fail = ()

modifyIORef :: ()
modifyIORef = ()

atomicModifyIORef :: ()
atomicModifyIORef = ()

zero :: ()
zero = ()

mfix :: ()
mfix = ()

(^?!) :: ()
(^?!) = ()

(^@?!) :: ()
(^@?!) = ()

foldr1Of :: ()
foldr1Of = ()

foldl1Of :: ()
foldl1Of = ()

foldr1Of' :: ()
foldr1Of' = ()

foldl1Of' :: ()
foldl1Of' = ()

singular :: ()
singular = ()

unsafeSingular :: ()
unsafeSingular = ()

unsafePartsOf :: ()
unsafePartsOf = ()

unsafePartsOf' :: ()
unsafePartsOf' = ()

iunsafePartsOf :: ()
iunsafePartsOf = ()

iunsafePartsOf' :: ()
iunsafePartsOf' = ()

throwing :: ()
throwing = ()

throwing_ :: ()
throwing_ = ()

putChar :: ()
putChar = ()

hGetChar :: ()
hGetChar = ()

readLn :: ()
readLn = ()

(!) :: ()
(!) = ()

wait :: ()
wait = ()

waitAny :: ()
waitAny = ()

waitEither :: ()
waitEither = ()

waitBoth :: ()
waitBoth = ()

link :: ()
link = ()

link2 :: ()
link2 = ()

getDirectoryContents :: ()
getDirectoryContents = ()

isSymbolicLink :: ()
isSymbolicLink = ()