about summary refs log tree commit diff
diff options
context:
space:
mode:
authorlukasepple <git@lukasepple.de>2015-11-01 13:35:11 +0100
committerlukasepple <git@lukasepple.de>2015-11-01 13:35:11 +0100
commit26b5dc1d8c4a3e59e79b95524d87fa726fbbd354 (patch)
tree2001427b0b57db92a134420dbdddea9d585a62eb
parent022ec74687a4dba8512f96c65b0a1eca31e1e758 (diff)
Add support for variation sequences and flags
-rw-r--r--emoji.cabal2
-rw-r--r--shell.nix6
-rw-r--r--src/Text/Emoji/Data.hs2
-rw-r--r--src/Text/Emoji/Types.hs4
4 files changed, 7 insertions, 7 deletions
diff --git a/emoji.cabal b/emoji.cabal
index 9a961ff..63c6041 100644
--- a/emoji.cabal
+++ b/emoji.cabal
@@ -23,8 +23,8 @@ library
   build-depends:       base
                      , bytestring
                      , text
-                     , attoparsec
                      , parsec
                      , split
+                     , utf8-light
   hs-source-dirs:      src
   default-language:    Haskell2010
diff --git a/shell.nix b/shell.nix
index 2fb0b14..160b524 100644
--- a/shell.nix
+++ b/shell.nix
@@ -4,15 +4,15 @@ let
 
   inherit (nixpkgs) pkgs;
 
-  f = { mkDerivation, attoparsec, base, bytestring, parsec, split
-      , stdenv, text
+  f = { mkDerivation, base, bytestring, parsec, split, stdenv, text
+      , utf8-light
       }:
       mkDerivation {
         pname = "emoji";
         version = "0.1.0.0";
         src = ./.;
         libraryHaskellDepends = [
-          attoparsec base bytestring parsec split text
+          base bytestring parsec split text utf8-light
         ];
         description = "Emoji name expander for different string types";
         license = stdenv.lib.licenses.gpl3;
diff --git a/src/Text/Emoji/Data.hs b/src/Text/Emoji/Data.hs
index 8f4f76e..2c6e51a 100644
--- a/src/Text/Emoji/Data.hs
+++ b/src/Text/Emoji/Data.hs
@@ -39,7 +39,7 @@ emojiCommentLine = do
 -- Left Emoji using all the information given.
 emojiDataEntry :: Parser (Either String Emoji)
 emojiDataEntry = do
-  code <- fst . head . readHex . filter (not . isSpace) <$> field hexDigit
+  code <- map (fst . head . readHex) . splitOn " " <$> field hexDigit
   style <- sumTypeField emojiStyles
   level <- sumTypeField emojiLevels
   modifier <- sumTypeField emojiModifierStati
diff --git a/src/Text/Emoji/Types.hs b/src/Text/Emoji/Types.hs
index 6acca16..e3dfb9a 100644
--- a/src/Text/Emoji/Types.hs
+++ b/src/Text/Emoji/Types.hs
@@ -8,7 +8,7 @@
 module Text.Emoji.Types where
 
 import           Data.Char (toLower)
-import           GHC.Word  (Word64 ())
+import           GHC.Word  (Word32 ())
 
 -- | Represents the default style
 -- an emoji is displayed as.
@@ -86,7 +86,7 @@ type EmojiSources = [EmojiSource]
 -- | Emoji holds all the information about an
 -- emoji provided by emoji-data.txt
 data Emoji = MkEmoji
-  { _code          :: Word64              -- ^ The code of the unicode character.
+  { _code          :: [Word32]            -- ^ The code of the unicode character.
   , _defaultStyle  :: EmojiStyle          -- ^ The default display style.
   , _emojiLevel    :: EmojiLevel          -- ^ Commonness for the character.
   , _emojiModifier :: EmojiModifierStatus -- ^ Wether the emoji is a modifier.