Data.Char

module Data.Char(module Data.Char,module Char{-,module U-}) where
import Char hiding (isLower,isAlpha,isUpper)
import qualified Char
--import Data.Char.Unicode as U

isLetter = isAlpha

isSymbol c = c `elem` "$+<=>^`|~\162\163\164\165\166\168\169\172\174\175\176\177\180\184\215\247\8743\8713\8745\8744\8712\8838\8746\8249\8250\8704"

isPunctuation c = c `elem` "!\"#%&'()*,-./:;?@[\\]_{}\161\167\171\182\183\187\191"

isAsciiLower c = isAscii c && Char.isLower c
isAsciiUpper c = isAscii c && Char.isUpper c


isAlpha c = isUpper c || isLower c

isLower c = Char.isLower c || isGreekLower c
isUpper c = Char.isUpper c || isGreekUpper c

isGreekLower c = '\945'<=c && c<= '\969'
isGreekUpper c = '\x391' <=c && c<= '\x3a9' && c/='\x3a2'

{-
isSymbol c = generalCategory c `elem` [MathSymbol,CurrencySymbol,ModifierSymbol,OtherSymbol]
isUpper c = Char.isUpper c || generalCategory c `elem` [UppercaseLetter,TitlecaseLetter]
isAlpha c = isUpper c || isLower c ||
            generalCategory c `elem` [ModifierLetter,OtherLetter]
-}

data GeneralCategory
  = UppercaseLetter | LowercaseLetter | TitlecaseLetter | ModifierLetter
  | OtherLetter
  | NonSpacingMark | SpacingCombiningMark | EnclosingMark
  | DecimalNumber | LetterNumber | OtherNumber
  | ConnectorPunctuation | DashPunctuation | OpenPunctuation | ClosePunctuation
  | InitialQuote | FinalQuote
  | OtherPunctuation
  | MathSymbol | CurrencySymbol | ModifierSymbol | OtherSymbol
  | Space | LineSeparator | ParagraphSeparator
  | Control
  | Format
  | Surrogate | PrivateUse
  | NotAssigned
  deriving (Eq,Ord,Enum,Bounded,Show,Read)

-- a quick hack
generalCategory c
  | isUpper c = UppercaseLetter
  | isLower c = LowercaseLetter
  | isSpace c = Space
  | isDigit c = DecimalNumber
  | isControl c = Control
  | otherwise   = NotAssigned -- !!!