File: Common.hs

package info (click to toggle)
haskell-data-reify 0.6.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 124 kB
  • sloc: haskell: 611; makefile: 3
file content (15 lines) | stat: -rw-r--r-- 564 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Common (head_, tail_) where

-- | Like 'head', but with a more specific error message in case the argument is
-- empty. This is primarily defined to avoid incurring @-Wx-partial@ warnings
-- whenever 'head' is used.
head_ :: [a] -> a
head_ (x:_) = x
head_ []    = error "head_: Empty list"

-- | Like 'tail', but with a more specific error message in case the argument is
-- empty. This is primarily defined to avoid incurring @-Wx-partial@ warnings
-- whenever 'tail' is used.
tail_ :: [a] -> [a]
tail_ (_:xs) = xs
tail_ []     = error "tail_: Empty list"