packages feed

himari-1.1.6.3: test/HlintSamples/ReexportSafePrelude.hs

{-# OPTIONS_GHC -Wno-x-partial #-}

-- Sample file to test that hlint rules match symbols re-exported through Himari.SafePrelude.
-- Himari.SafePrelude is the subset of himari that can be imported under Safe Haskell.
module HlintSamples.ReexportSafePrelude where

import Himari.SafePrelude

-- These should trigger warnings
useHead :: [Int] -> Int
useHead = head

useFoldl1 :: [Int] -> Int
useFoldl1 = foldl1 (+)

useBifoldl1 :: (Int, Int) -> Int
useBifoldl1 = bifoldl1 (+)

useFromJust :: Maybe Int -> Int
useFromJust = fromJust

useReadFile :: IO String
useReadFile = readFile "foo.txt"

useSingular :: [Int] -> Int
useSingular xs = xs ^. singular traverse

-- These should NOT trigger warnings
useHeadMay :: [Int] -> Maybe Int
useHeadMay = headMay