Skip to content

Commit 346c275

Browse files
Port across GHC versions
Support 7.8, 7.10 and 8.0 Conflicts: benchmark/Benchmark.hs test/NormalizationTest.hs
1 parent 84da52a commit 346c275

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

Data/Unicode/Types.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
{-# LANGUAGE CPP #-}
2+
#if __GLASGOW_HASKELL__ < 7100
3+
{-# LANGUAGE DeriveDataTypeable #-}
4+
#endif
15
-- |
26
-- Module : Data.Unicode.Types
37
-- Copyright : (c) 2016 Harendra Kumar

Data/Unicode/UTF8Proc.hsc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{-# LANGUAGE CPP #-}
22
{-# LANGUAGE ForeignFunctionInterface #-}
33

4+
#if __GLASGOW_HASKELL__ < 7100
5+
{-# LANGUAGE DeriveDataTypeable #-}
6+
#endif
7+
48
-- |
59
-- Module : Data.Unicode.UTF8Proc
610
-- Copyright : (c) 2016 Harendra Kumar

benchmark/Benchmark.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE TemplateHaskell #-}
23

34
-- |
@@ -9,6 +10,9 @@
910
-- Portability : GHC
1011
--
1112

13+
#if !MIN_VERSION_base(4,8,0)
14+
import Control.Applicative ((<$>), (<*>))
15+
#endif
1216
import Control.DeepSeq (NFData)
1317
import Criterion.Main (Benchmark, bench, bgroup, defaultMain, nf)
1418
import Data.Text (Text)

test/NormalizationTest.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE OverloadedStrings #-}
2-
{-# LANGUAGE TupleSections #-}
3+
{-# LANGUAGE TupleSections #-}
34

45
-- |
56
-- Copyright : (c) 2016 Harendra Kumar
@@ -12,14 +13,21 @@
1213

1314
import Control.Monad (when)
1415
import Data.Char (chr, isSpace, ord, toUpper)
16+
#if MIN_VERSION_base(4,8,0)
1517
import Data.Function ((&))
18+
#endif
1619
import Data.List (intercalate, isPrefixOf)
1720
import Data.List.Split (splitOn)
1821
import Data.Text (Text)
1922
import qualified Data.Text as T
2023
import Data.Text.Normalize (NormalizationMode (..), normalize)
2124
import Text.Printf (printf)
2225

26+
#if !MIN_VERSION_base(4,8,0)
27+
(&) :: a -> (a -> b) -> b
28+
x & f = f x
29+
#endif
30+
2331
chrToHex :: Char -> [Char]
2432
chrToHex = (map toUpper) . (printf "%.4x") . ord
2533

0 commit comments

Comments
 (0)