File: Main.hs

package info (click to toggle)
haskell-rfc5051 0.2-4
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,900 kB
  • sloc: haskell: 54; makefile: 6
file content (22 lines) | stat: -rw-r--r-- 760 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import System.Exit
import qualified Data.Text as T
import Data.RFC5051 (compareUnicode)
import Data.List (sortBy)

main :: IO ()
main = do
  let ls = map T.pack ["Abe", "Oeb", "abe", "ab\233", "oeb",
                       "\193be", "\196be", "\212eb", "\225be",
                       "\228be", "\244eb"]
  let expected = map T.pack
                      ["Abe", "abe", "ab\233", "\193be", "\225be",
                       "\196be", "\228be", "Oeb", "oeb", "\212eb",
                       "\244eb"]
  let actual = sortBy compareUnicode ls
  if actual == expected
     then exitWith ExitSuccess
     else do
       putStrLn "FAILED"
       putStrLn $ "EXPECTED: " ++ show expected
       putStrLn $ "GOT:      " ++ show actual
       exitWith $ ExitFailure 1