packages feed

ghc-exactprint-0.5.0.0: tests/examples/ghc8/T10602b.hs

{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE NoImplicitPrelude #-}
module T10602b (splitAt, map, foldr) where

import GHC.Classes
import GHC.Types
import GHC.Num
import GHC.Base

splitAt                :: Int -> [a] -> ([a],[a])
splitAt n ls
  | n <= 0 = ([], ls)
  | otherwise          = splitAt' n ls
    where
        splitAt' :: Int -> [a] -> ([a], [a])
        splitAt' _  []     = ([], [])
        splitAt' 1  (x:xs) = ([x], xs)
        splitAt' m  (x:xs) = (x:xs', xs'')
          where
            (xs', xs'') = splitAt' (m - 1) xs