packages feed

hs-openmoji-data (empty) → 13.0.0

raw patch · 8 files changed

+361/−0 lines, 8 filesdep +basedep +containersdep +emojissetup-changed

Dependencies added: base, containers, emojis, hs-openmoji-data, text

Files

+ CHANGELOG.md view
@@ -0,0 +1,5 @@+# Revision history for hs-openmoji++## 13.0.0++* Generated OpenMoji data from [OpenMoji v13.0](https://github.com/hfg-gmuend/openmoji/releases/tag/13.0.0)
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2020, Obsidian Systems LLC++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Obsidian Systems LLC nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.lhs view
@@ -0,0 +1,114 @@+hs-openmoji-data+================+[![Built with Nix](https://img.shields.io/static/v1?logo=nixos&logoColor=white&label=&message=Built%20with%20Nix&color=41439a)](https://nixos.org) [![Haskell](https://img.shields.io/badge/language-Haskell-orange.svg)](https://haskell.org) [![Hackage](https://img.shields.io/hackage/v/hs-openmoji-data.svg)](https://hackage.haskell.org/package/hs-openmoji-data) [![Hackage CI](https://matrix.hackage.haskell.org/api/v2/packages/hs-openmoji-data/badge)](https://matrix.hackage.haskell.org/#/package/hs-openmoji-data)   [![Github CI](https://github.com/obsidiansystems/hs-openmoji-data/workflows/github-action/badge.svg)](https://github.com/obsidiansystems/hs-openmoji-data/actions) [![BSD3 License](https://img.shields.io/badge/license-BSD3-blue.svg)](https://github.com/obsidiansystems/hs-openmoji-data/blob/master/LICENSE)+++The OpenMoji emoji dataset for use in Haskell programs.++For emoji fonts, images, and spritesheets, please consult the documentation at [openmoji.org](https://openmoji.org/).+++* [Updating the emojis](#updating-the-emojis)+* [Versioning](#versioning)+* [Example Usage](#example-usage)+* [About the Emojis](#about-the-emojis)++Updating the emojis+-------------------++Use [nix-thunk](https://github.com/obsidiansystems/nix-thunk) to update the pinned version of openmoji and then use the generator script to produce a new `Data.hs` file:++```bash+nix-thunk update ./openmoji+./gen.sh+```++Versioning+-------------------++Versions of this package should correspond to the OpenMoji version number used to generate the data.++Example Usage+-------------------++```haskell++> {-# Language LambdaCase #-}+> {-# Language OverloadedStrings #-}+>+> import Control.Monad+> import Data.Map (Map)+> import qualified Data.Map as Map+> import Data.Text (Text)+> import qualified Data.Text as T+> import System.Environment+> import Text.Emoji (emojiFromAlias)+> import Text.Emoji.OpenMoji.Data+> import Text.Emoji.OpenMoji.Types+>+> emojiMap :: Map Text OpenMoji+> emojiMap = Map.fromList $ map (\x -> (_openMoji_emoji x, x)) openmojis+> +> main :: IO ()+> main = do+>   requestedAliases <- getArgs+>   when (null requestedAliases) $+>     putStrLn "Please search for at least one emoji alias (e.g., \"bricks\")"+>   forM_ requestedAliases $ \alias ->+>     case (\e -> Map.lookup e emojiMap) =<< emojiFromAlias (T.pack alias) of+>       Nothing -> putStrLn $ "Results for '" <> alias <> "': None"+>       Just openmoji -> do+>         putStrLn $ "Results for '" <> alias <> "':"+>         printOpenMojiInfo openmoji+>+> versionedSvg :: Text -> Text -> Text+> versionedSvg rev hex = mconcat+>   [ "https://raw.githubusercontent.com/hfg-gmuend/openmoji/"+>   , rev+>   , "/color/svg/"+>   , hex+>   , ".svg"+>   ]+>+> pinnedRevision :: Text+> pinnedRevision = "4a80b536eb62a78822548a2aa371426f912d7e9d" -- v13+>+> printOpenMojiInfo :: OpenMoji -> IO ()+> printOpenMojiInfo o = putStrLn $ T.unpack $ T.unlines+>   [ "Emoji:      " <> _openMoji_emoji o+>   , "Hexcode:    " <> _openMoji_hexcode o+>   , "Annotation: " <> _openMoji_annotation o+>   , "Group:      " <> _openMoji_group o+>   , "Sub-Group:  " <> _openMoji_subgroups o+>   , "Tags:       " <> T.intercalate ", " (_openMoji_tags o)+>   , "SVG:        " <> versionedSvg pinnedRevision (_openMoji_hexcode o)+>   ]++```++This program should will something like the following:++```+Results for 'bricks':+Emoji:      🧱+Hexcode:    1F9F1+Annotation: brick+Group:      travel-places+Sub-Group:  place-building+Tags:       bricks, clay, mortar, wall+SVG:        https://raw.githubusercontent.com/hfg-gmuend/openmoji/4a80b536eb62a78822548a2aa371426f912d7e9d/color/svg/1F9F1.svg++Results for 'pilot':+Emoji:      🧑‍✈️+Hexcode:    1F9D1-200D-2708-FE0F+Annotation: pilot+Group:      people-body+Sub-Group:  person-role+Tags:       plane+SVG:        https://raw.githubusercontent.com/hfg-gmuend/openmoji/4a80b536eb62a78822548a2aa371426f912d7e9d/color/svg/1F9D1-200D-2708-FE0F.svg+```++About the Emojis+-------------------++All emojis designed by OpenMoji – the open-source emoji and icon project. License: CC BY-SA 4.0
+ README.md view
@@ -0,0 +1,114 @@+hs-openmoji-data+================+[![Built with Nix](https://img.shields.io/static/v1?logo=nixos&logoColor=white&label=&message=Built%20with%20Nix&color=41439a)](https://nixos.org) [![Haskell](https://img.shields.io/badge/language-Haskell-orange.svg)](https://haskell.org) [![Hackage](https://img.shields.io/hackage/v/hs-openmoji-data.svg)](https://hackage.haskell.org/package/hs-openmoji-data) [![Hackage CI](https://matrix.hackage.haskell.org/api/v2/packages/hs-openmoji-data/badge)](https://matrix.hackage.haskell.org/#/package/hs-openmoji-data)   [![Github CI](https://github.com/obsidiansystems/hs-openmoji-data/workflows/github-action/badge.svg)](https://github.com/obsidiansystems/hs-openmoji-data/actions) [![BSD3 License](https://img.shields.io/badge/license-BSD3-blue.svg)](https://github.com/obsidiansystems/hs-openmoji-data/blob/master/LICENSE)+++The OpenMoji emoji dataset for use in Haskell programs.++For emoji fonts, images, and spritesheets, please consult the documentation at [openmoji.org](https://openmoji.org/).+++* [Updating the emojis](#updating-the-emojis)+* [Versioning](#versioning)+* [Example Usage](#example-usage)+* [About the Emojis](#about-the-emojis)++Updating the emojis+-------------------++Use [nix-thunk](https://github.com/obsidiansystems/nix-thunk) to update the pinned version of openmoji and then use the generator script to produce a new `Data.hs` file:++```bash+nix-thunk update ./openmoji+./gen.sh+```++Versioning+-------------------++Versions of this package should correspond to the OpenMoji version number used to generate the data.++Example Usage+-------------------++```haskell++> {-# Language LambdaCase #-}+> {-# Language OverloadedStrings #-}+>+> import Control.Monad+> import Data.Map (Map)+> import qualified Data.Map as Map+> import Data.Text (Text)+> import qualified Data.Text as T+> import System.Environment+> import Text.Emoji (emojiFromAlias)+> import Text.Emoji.OpenMoji.Data+> import Text.Emoji.OpenMoji.Types+>+> emojiMap :: Map Text OpenMoji+> emojiMap = Map.fromList $ map (\x -> (_openMoji_emoji x, x)) openmojis+> +> main :: IO ()+> main = do+>   requestedAliases <- getArgs+>   when (null requestedAliases) $+>     putStrLn "Please search for at least one emoji alias (e.g., \"bricks\")"+>   forM_ requestedAliases $ \alias ->+>     case (\e -> Map.lookup e emojiMap) =<< emojiFromAlias (T.pack alias) of+>       Nothing -> putStrLn $ "Results for '" <> alias <> "': None"+>       Just openmoji -> do+>         putStrLn $ "Results for '" <> alias <> "':"+>         printOpenMojiInfo openmoji+>+> versionedSvg :: Text -> Text -> Text+> versionedSvg rev hex = mconcat+>   [ "https://raw.githubusercontent.com/hfg-gmuend/openmoji/"+>   , rev+>   , "/color/svg/"+>   , hex+>   , ".svg"+>   ]+>+> pinnedRevision :: Text+> pinnedRevision = "4a80b536eb62a78822548a2aa371426f912d7e9d" -- v13+>+> printOpenMojiInfo :: OpenMoji -> IO ()+> printOpenMojiInfo o = putStrLn $ T.unpack $ T.unlines+>   [ "Emoji:      " <> _openMoji_emoji o+>   , "Hexcode:    " <> _openMoji_hexcode o+>   , "Annotation: " <> _openMoji_annotation o+>   , "Group:      " <> _openMoji_group o+>   , "Sub-Group:  " <> _openMoji_subgroups o+>   , "Tags:       " <> T.intercalate ", " (_openMoji_tags o)+>   , "SVG:        " <> versionedSvg pinnedRevision (_openMoji_hexcode o)+>   ]++```++This program should will something like the following:++```+Results for 'bricks':+Emoji:      🧱+Hexcode:    1F9F1+Annotation: brick+Group:      travel-places+Sub-Group:  place-building+Tags:       bricks, clay, mortar, wall+SVG:        https://raw.githubusercontent.com/hfg-gmuend/openmoji/4a80b536eb62a78822548a2aa371426f912d7e9d/color/svg/1F9F1.svg++Results for 'pilot':+Emoji:      🧑‍✈️+Hexcode:    1F9D1-200D-2708-FE0F+Annotation: pilot+Group:      people-body+Sub-Group:  person-role+Tags:       plane+SVG:        https://raw.githubusercontent.com/hfg-gmuend/openmoji/4a80b536eb62a78822548a2aa371426f912d7e9d/color/svg/1F9D1-200D-2708-FE0F.svg+```++About the Emojis+-------------------++All emojis designed by OpenMoji – the open-source emoji and icon project. License: CC BY-SA 4.0
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ hs-openmoji-data.cabal view
@@ -0,0 +1,47 @@+cabal-version:      >=1.10+name:               hs-openmoji-data+version:            13.0.0+synopsis:           The OpenMoji emoji dataset+description:+  This library simply exposes the OpenMoji emoji dataset as some data in Haskell++bug-reports:        https://github.com/obsidiansystems/hs-openmoji-data/issues+license:            BSD3+license-file:       LICENSE+author:             Obsidian Systems LLC+maintainer:         maintainer@obsidian.systems+copyright:          2020 Obsidian Systems LLC+category:           Data, Text+build-type:         Simple+extra-source-files:+  CHANGELOG.md+  README.md++library+  exposed-modules:+    Text.Emoji.OpenMoji.Data+    Text.Emoji.OpenMoji.Types++  build-depends:+      base  >=4.12 && <4.15+    , text  >=1.2  && <1.3++  hs-source-dirs:   src+  default-language: Haskell2010+  ghc-options:      -Wall++executable readme+  build-depends:+      base+    , containers        >=0.6 && <0.7+    , emojis            >=0.1 && <0.2+    , hs-openmoji-data+    , text++  default-language: Haskell2010+  main-is:          README.lhs+  ghc-options:      -Wall -optL -q++source-repository head+  type:     git+  location: git://github.com/obsidiansystems/hs-openmoji-data.git
+ src/Text/Emoji/OpenMoji/Data.hs view

file too large to diff

+ src/Text/Emoji/OpenMoji/Types.hs view
@@ -0,0 +1,49 @@+{-# Language DeriveGeneric #-}+{-|+ Description:+   Types corresponding to OpenMoji's raw JSON data format.+-}+module Text.Emoji.OpenMoji.Types where+import Data.Text (Text)+import GHC.Generics (Generic)++-- | This record corresponds to the json format used in the OpenMoji dataset.+-- For example:+--+-- @+-- {+--     "emoji": "🖐️",+--     "hexcode": "1F590",+--     "group": "people-body",+--     "subgroups": "hand-fingers-open",+--     "annotation": "hand with fingers splayed",+--     "tags": "finger, hand, splayed",+--     "openmoji_tags": "Five Hand, Hand, Five, Splayed",+--     "openmoji_author": "Julian Grüneberg",+--     "openmoji_date": "2018-04-18",+--     "skintone": "",+--     "skintone_combination": "single",+--     "skintone_base_emoji": "🖐️",+--     "skintone_base_hexcode": "1F590",+--     "unicode": 0.7,+--     "order": 176+--   }+-- @+data OpenMoji = OpenMoji+  { _openMoji_annotation :: Text+  , _openMoji_emoji :: Text+  , _openMoji_group :: Text+  , _openMoji_hexcode :: Text+  , _openMoji_openmoji_author :: Text+  , _openMoji_openmoji_date :: Text+  , _openMoji_openmoji_tags :: [Text]+  , _openMoji_order :: Maybe Int+  , _openMoji_skintone :: [Text]+  , _openMoji_skintone_base_emoji :: Text+  , _openMoji_skintone_base_hexcode :: Text+  , _openMoji_skintone_combination :: Text+  , _openMoji_subgroups :: Text+  , _openMoji_tags :: [Text]+  , _openMoji_unicode :: Text+  }+  deriving (Read, Show, Eq, Ord, Generic)