haskmon (empty) → 0.1.0.0
raw patch · 17 files changed
+815/−0 lines, 17 filesdep +aesondep +basedep +bytestringsetup-changed
Dependencies added: aeson, base, bytestring, containers, http-streams, io-streams, old-locale, time, vector
Files
- LICENSE +21/−0
- Setup.hs +2/−0
- haskmon.cabal +45/−0
- src/Haskmon.hs +18/−0
- src/Haskmon/Client.hs +81/−0
- src/Haskmon/Resource.hs +25/−0
- src/Haskmon/Types.hs +11/−0
- src/Haskmon/Types/Ability.hs +23/−0
- src/Haskmon/Types/Description.hs +31/−0
- src/Haskmon/Types/EggGroup.hs +25/−0
- src/Haskmon/Types/Game.hs +23/−0
- src/Haskmon/Types/Internals.hs +315/−0
- src/Haskmon/Types/MetaData.hs +18/−0
- src/Haskmon/Types/Move.hs +34/−0
- src/Haskmon/Types/Pokemon.hs +83/−0
- src/Haskmon/Types/Sprite.hs +24/−0
- src/Haskmon/Types/Type.hs +36/−0
+ LICENSE view
@@ -0,0 +1,21 @@+The MIT License (MIT)++Copyright (c) 2014 Pedro Rodriguez++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ haskmon.cabal view
@@ -0,0 +1,45 @@+name: haskmon+version: 0.1.0.0+synopsis: A haskell wrapper for PokeAPI.co (www.pokeapi.co)+description: This is a haskell wrapper for the RESTful api www.pokeapi.co. It defines most of the types and functions to get them.+license: MIT+license-file: LICENSE+author: Pedro Rodriguez+maintainer: P.J.Rodriguez.T@gmail.com+category: Web, Game++build-type: Simple+cabal-version: >=1.10++library+ hs-source-dirs: src+ exposed-modules: Haskmon,+ Haskmon.Client,+ Haskmon.Resource,+ Haskmon.Types,+ Haskmon.Types.Internals+ other-modules:+ Haskmon.Types.Game+ Haskmon.Types.Move+ Haskmon.Types.Type+ Haskmon.Types.Sprite+ Haskmon.Types.Ability+ Haskmon.Types.Pokemon+ Haskmon.Types.MetaData+ Haskmon.Types.EggGroup+ Haskmon.Types.Description+ build-depends: base >=4.7 && <4.8,+ http-streams ==0.7.1.1,+ bytestring ==0.10.0.2,+ io-streams ==1.1.4.2,+ aeson ==0.7.*,+ time,+ vector ==0.10.*,+ old-locale == 1.*,+ containers ==0.5.5.1+ default-language: Haskell2010++source-repository head+ type: git+ location: https://github.com/pjrt/Haskmon.git+
+ src/Haskmon.hs view
@@ -0,0 +1,18 @@+-- | Examples:+--+-- >>> import Haskmon+-- >>> getPokemonByName "eevee" :: IO (Maybe Pokemon)+-- Just (Pokemon {pokemonName = "Eevee", pokemonNationalId = 133, ... })+-- >>> getMoveById 1 :: IO Move+-- Move {moveName = "Pound", movePower = 40, movePp = 35, moveAccuracy = 100, moveMetadata = MetaData {resourceUri = "/api/v1/move/1/", created = 2013-11-03 15:06:09.478009 UTC, modified = 2013-12-24 15:24:29.625596 UTC}}+--+-- For a full list of types (pokemons, moves, abilities, etc) see "Haskmon.Types".+-- For a full list of getter functions, see "Haskmon.Client".++module Haskmon (+ module Haskmon.Types,+ module Haskmon.Client+) where++import Haskmon.Types+import Haskmon.Client
+ src/Haskmon/Client.hs view
@@ -0,0 +1,81 @@+module Haskmon.Client(+ getPokedexById,+ getNationalPokedex,+ getPokemonById,+ getPokemonByName,+ getAbilityById,+ getMoveById,+ getTypeById,+ getEggGroupById,+ getDescriptionById,+ getGameById,+ getSpriteById+) where++import Haskmon.Types+import Haskmon.Resource(getResource)+import Data.Word+import Data.Aeson(FromJSON)+import Data.List(find)+import Data.Char(toLower)+import Control.Applicative((<$>))+import qualified Data.Traversable as T++type ID = Word++-- | Utility wrapper for `ById` functions+getResourceById :: FromJSON a => String -> ID -> IO a+getResourceById res dbId = getResource $ "api/v1/" ++ res ++ "/" ++ show dbId ++ "/"++----------------------------------------------------------------------------++-- | Get a pokedex. Warning: returns a large list of pokemon resources+getPokedexById :: ID -> IO Pokedex+getPokedexById = getResourceById "pokedex"++getNationalPokedex :: IO Pokedex+getNationalPokedex = getPokedexById 1 -- At the moment, this is the only pokedex++-- | Get a pokemon by ID+getPokemonById :: ID -> IO Pokemon+getPokemonById = getResourceById "pokemon"++-- | Lookup a pokemon by name in the national pokedex+-- WARNING: Calls the pokedex api which returns a big list. It then does a lookup by name on said list.+getPokemonByName :: String -- ^ Name of the pokemon+ -> IO (Maybe Pokemon) -- ^ If no pokemon is found, return IO Nothing+getPokemonByName name = do+ metaPkms <- pokedexPokemons <$> getNationalPokedex+ let lName = toLower <$> name -- Lowercase it. All names in the pokedex meta are lower+ maybePk = find ( (==) lName . mPokemonName) metaPkms+ T.sequence $ fmap getPokemon maybePk++-- | Get an ability by ID+getAbilityById :: ID -> IO Ability+getAbilityById = getResourceById "ability"++-- | Get a move by ID+getMoveById :: ID -> IO Move+getMoveById = getResourceById "move"++-- | Get a type by ID+getTypeById :: ID -> IO Type+getTypeById = getResourceById "type"+--+-- | Get a egg group by ID+getEggGroupById :: ID -> IO EggGroup+getEggGroupById = getResourceById "egg"++-- | Get a description group by ID+getDescriptionById :: ID -> IO Description+getDescriptionById = getResourceById "description"++-- | Get a game by ID+getGameById :: ID -> IO Description+getGameById = getResourceById "game"++-- | Get Sprite by ID+getSpriteById :: ID -> IO Sprite+getSpriteById = getResourceById "sprite"++
+ src/Haskmon/Resource.hs view
@@ -0,0 +1,25 @@+-- Resource getter. Used by everything else+module Haskmon.Resource(getResource) where++import Data.Word+import Data.Aeson+import Data.Either+import Network.Http.Client+import qualified Data.ByteString as B+import qualified Data.ByteString.Char8 as B8+import Control.Applicative((<$>))++-- | Host of the API+host = "http://pokeapi.co/"++-- | Uri of the resource+type Uri = String++-- | GET the resource from the URI and parse it into one of the "Haskmon.Types".+-- Fails if the parsing fails (ie: the library needs to be updated).+getResource :: FromJSON a => Uri -> IO a+getResource uri = decodeAndErr <$> get (B8.pack uri') concatHandler+ where uri' = host ++ uri+ decodeAndErr :: FromJSON a => B.ByteString -> a+ decodeAndErr = either decodeErr id . eitherDecodeStrict'+ decodeErr err = error $ "Error parsing resource " ++ uri' ++ ": " ++ err
+ src/Haskmon/Types.hs view
@@ -0,0 +1,11 @@+module Haskmon.Types(module X) where++import Haskmon.Types.Game as X+import Haskmon.Types.Move as X+import Haskmon.Types.Type as X+import Haskmon.Types.Sprite as X+import Haskmon.Types.Ability as X+import Haskmon.Types.Pokemon as X+import Haskmon.Types.MetaData as X+import Haskmon.Types.EggGroup as X+import Haskmon.Types.Description as X
+ src/Haskmon/Types/Ability.hs view
@@ -0,0 +1,23 @@+module Haskmon.Types.Ability(+ module Haskmon.Types.Ability,+ I.Ability, I.MetaAbility+) where++import Data.Word+import Haskmon.Types.Internals(MetaData, MetaAbility, Ability)+import qualified Haskmon.Types.Internals as I++mAbilityName :: MetaAbility -> String+mAbilityName = I.mAbilityName++getAbility :: MetaAbility -> IO Ability+getAbility = I.getAbility++abilityName :: Ability -> String+abilityName = I.abilityName++abilityDescription :: Ability -> String+abilityDescription = I.abilityDescription++abilityMetadata :: Ability -> MetaData+abilityMetadata = I.abilityMetadata
+ src/Haskmon/Types/Description.hs view
@@ -0,0 +1,31 @@+module Haskmon.Types.Description(+ module Haskmon.Types.Description,+ I.Description, I.MetaDescription+) where++import Data.Word+import Haskmon.Types.Internals(MetaData, MetaPokemon, MetaGame, MetaDescription, Description)+import qualified Haskmon.Types.Internals as I++mDescriptionName :: MetaDescription -> String+mDescriptionName = I.mDescriptionName++getDescriptions :: MetaDescription -> IO Description+getDescriptions = I.getDescriptions+++descriptionName :: Description -> String+descriptionName = I.descriptionName++descriptionText :: Description -> String+descriptionText = I.descriptionText++descriptionGames :: Description -> [MetaGame]+descriptionGames = I.descriptionGames++descriptionPokemon :: Description -> MetaPokemon+descriptionPokemon = I.descriptionPokemon++descriptionMetadata :: Description -> MetaData+descriptionMetadata = I.descriptionMetadata+
+ src/Haskmon/Types/EggGroup.hs view
@@ -0,0 +1,25 @@+module Haskmon.Types.EggGroup(+ module Haskmon.Types.EggGroup,+ I.EggGroup, I.MetaEggGroup+) where++import Data.Word+import Haskmon.Types.Internals(MetaData, MetaEggGroup, EggGroup, MetaPokemon)+import qualified Haskmon.Types.Internals as I+++mEggGroupName :: MetaEggGroup -> String+mEggGroupName = I.mEggGroupName++getEggGroup :: MetaEggGroup -> IO EggGroup+getEggGroup = I.getEggGroup+++eggGroupName :: EggGroup -> String+eggGroupName = I.eggGroupName++eggGroupPokemons :: EggGroup -> [MetaPokemon]+eggGroupPokemons = I.eggGroupPokemons++eggGroupMetadata :: EggGroup -> MetaData+eggGroupMetadata = I.eggGroupMetadata
+ src/Haskmon/Types/Game.hs view
@@ -0,0 +1,23 @@+module Haskmon.Types.Game where++import Data.Word+import Haskmon.Types.Internals(MetaData, MetaGame, Game)+import qualified Haskmon.Types.Internals as I++mGameName :: MetaGame -> String+mGameName = I.mGameName++getGame :: MetaGame -> IO Game+getGame = I.getGame++gameName :: Game -> String+gameName = I.gameName++gameGeneration :: Game -> Word+gameGeneration = I.gameGeneration++gameReleaseYear :: Game -> Word+gameReleaseYear = I.gameReleaseYear++gameMetadata :: Game -> MetaData+gameMetadata = I.gameMetadata
+ src/Haskmon/Types/Internals.hs view
@@ -0,0 +1,315 @@+{-# LANGUAGE OverloadedStrings #-}+module Haskmon.Types.Internals where++import Data.Word+import Data.Vector(toList)+import Data.Aeson+import Data.Aeson.Types+import Data.Time.Format+import Data.Time.Clock+import Data.List(find)++import System.Locale++import Control.Applicative+import Control.Monad(mzero)++import Haskmon.Resource(getResource)++-- {{{ MetaData+-- | Metadata that all resources (except Pokedex) have in common+data MetaData = MetaData {+ resourceUri :: String,+ created :: UTCTime,+ modified :: UTCTime+ } deriving Show++getMetadata :: Object -> Parser MetaData+getMetadata v = MetaData <$>+ v .: "resource_uri" <*>+ convert (v .: "created") <*>+ convert (v .: "modified")+ where convert :: Parser String -> Parser UTCTime+ convert ps = readTime defaultTimeLocale formatStr <$> ps+ formatStr = "%FT%R:%S%Q"++-- Alias for withObject+withO o f = withObject "object" f o++-- }}}+-- Pokedex {{{+data Pokedex = Pokedex {+ pokedexName :: String,+ pokedexPokemons :: [MetaPokemon]+ }++instance Show Pokedex where+ show p = "<Pokedex - " ++ pokedexName p ++ ">"++instance FromJSON MetaPokemon where+ parseJSON (Object o) = MetaPokemon <$> o .: "name" <*> (getResource <$> o .: "resource_uri")++instance FromJSON Pokedex where+ parseJSON (Object o) = Pokedex <$> o .: "name" <*> o .: "pokemon"+ parseJSON _ = mzero++-- }}}+-- Pokemon {{{+data MetaPokemon = MetaPokemon { mPokemonName :: String, getPokemon :: IO Pokemon }+instance Show MetaPokemon where+ show p = "<MetaPokemon - " ++ mPokemonName p ++ ">"++data Pokemon = Pokemon {+ pokemonName :: String,+ pokemonNationalId :: Word,+ pokemonAbilities :: [MetaAbility],+ pokemonMoves :: [MetaMove],+ pokemonTypes :: [MetaType],+ pokemonEggCycle :: Word,+ pokemonEggGroups :: [MetaEggGroup],+ pokemonCatchRate :: Word,+ pokemonHp :: Word,+ pokemonAttack :: Word,+ pokemonDefense :: Word,+ pokemonSpAtk :: Word,+ pokemonSpDef :: Word,+ pokemonSpeed :: Word,+ pokemonSprites :: [MetaSprite],+ pokemonDescriptions :: [MetaDescription],+ pokemonMetadata :: MetaData+ } deriving Show++instance FromJSON Pokemon where+ parseJSON o = withO o go+ where go v = Pokemon <$>+ v .: "name" <*>+ v .: "national_id" <*>+ v .: "abilities" <*>+ v .: "moves" <*>+ v .: "types" <*>+ v .: "egg_cycles" <*>+ v .: "egg_groups" <*>+ v .: "catch_rate" <*>+ v .: "hp" <*>+ v .: "attack" <*>+ v .: "defense" <*>+ v .: "sp_atk" <*>+ v .: "sp_def" <*>+ v .: "speed" <*>+ v .: "sprites" <*>+ v .: "descriptions" <*>+ getMetadata v+++--- }}}+-- Evolution {{{+{- At the moment, evolutions don't seem to be very consistent or complete (in the Rest API).+ - Ignoring for now+data Evolution = Evolution {+ evolutionName :: String,+ evolutionMethod :: EvolutionMethod+ evolutionPokemon :: IO Pokemon+ }+data EvolutionMethod = LevelUp { evolutionLevel :: Word }+ | Friendship+-}+-- }}}+-- Ability {{{+data MetaAbility = MetaAbility { mAbilityName :: String, getAbility :: IO Ability}+instance Show MetaAbility where+ show p = "<MetaAbility - " ++ mAbilityName p ++ ">"++data Ability = Ability { abilityName :: String,+ abilityDescription :: String,+ abilityMetadata :: MetaData+ } deriving Show++instance FromJSON Ability where+ parseJSON o = withO o $ \v -> Ability <$>+ v .: "name" <*>+ v .: "description" <*>+ getMetadata v++instance FromJSON MetaAbility where+ parseJSON v = withO v $ \o -> MetaAbility <$> o .: "name" <*>+ (getResource <$> o .: "resource_uri")++-- }}}+-- Types {{{+data MetaType = MetaType { mTypeName :: String, getType :: IO Type }+instance Show MetaType where+ show p = "<MetaType - " ++ mTypeName p ++ ">"++data Type = Type {+ typeName :: String,+ typeIneffective :: [Type],+ typeNoEffect :: [Type],+ typeResistance :: [Type],+ typeSuperEffective :: [Type],+ typeWeakness :: [Type],+ typeMetadata :: MetaData+ } deriving Show++instance FromJSON Type where+ parseJSON v = withO v $ \o -> Type <$>+ o .: "name" <*>+ o .: "ineffective" <*>+ o .: "no_effect" <*>+ o .: "resistance" <*>+ o .: "super_effective" <*>+ o .: "weakness" <*>+ getMetadata o++instance FromJSON MetaType where+ parseJSON v = withO v $ \o -> MetaType <$> o .: "name" <*>+ (getResource <$> o .: "resource_uri")++-- }}}+-- Moves {{{+data MetaMoveLearnType = LevelUp Int+ | Machine+ | Tutor+ | EggMove+ | Other deriving Show++data MetaMove = MetaMove { mMoveName :: String,+ mMoveLearnType :: MetaMoveLearnType,+ getMove :: IO Move}+instance Show MetaMove where+ show p = "<MetaMove - " ++ mMoveName p ++ ">"++data Move = Move {+ moveName :: String,+ movePower :: Word,+ movePp :: Word,+ moveAccuracy :: Word,+ moveMetadata :: MetaData+ } deriving Show++instance FromJSON Move where+ parseJSON v = withO v $ \o -> Move <$>+ o .: "name" <*>+ o .: "power" <*>+ o .: "pp" <*>+ o .: "accuracy" <*>+ getMetadata o++instance FromJSON MetaMove where+ parseJSON v = withO v go+ where go o = MetaMove <$> o .: "name" <*>+ mmLearnType <*>+ (getResource <$> o .: "resource_uri")+ where mmLearnType :: Parser MetaMoveLearnType+ mmLearnType = do+ learnType <- o .: "learn_type" :: Parser String+ case learnType of+ "level up" -> LevelUp <$> (o .: "level")+ "machine" -> return Machine+ "tutor" -> return Tutor+ "egg move" -> return EggMove+ "other" -> return Other+ err -> fail $ "expected level_up, machine, tutor, egg_move or other. Got " ++ err++-- }}}+-- EGGS!!! {{{+data MetaEggGroup = MetaEggGroup {+ mEggGroupName :: String,+ getEggGroup :: IO EggGroup+ }+instance Show MetaEggGroup where+ show p = "<MetaEggGroup - " ++ mEggGroupName p ++ ">"++data EggGroup = EggGroup { eggGroupName :: String,+ eggGroupPokemons :: [MetaPokemon],+ eggGroupMetadata :: MetaData+ } deriving Show++instance FromJSON EggGroup where+ parseJSON v = withO v $ \o -> EggGroup <$>+ o .: "name" <*>+ o .: "pokemon" <*>+ getMetadata o+++instance FromJSON MetaEggGroup where+ parseJSON v = withO v $ \o -> MetaEggGroup <$>+ o .: "name" <*>+ (getResource <$> o .: "resource_uri")+--- }}}+-- Description {{{+data MetaDescription = MetaDescription {+ mDescriptionName :: String,+ getDescriptions :: IO Description+ }++data Description = Description {+ descriptionName :: String,+ descriptionText :: String,+ descriptionGames :: [MetaGame],+ descriptionPokemon :: MetaPokemon,+ descriptionMetadata :: MetaData+ } deriving Show++instance Show MetaDescription where+ show set = "<MetaDescription - " ++ mDescriptionName set ++ ">"++instance FromJSON Description where+ parseJSON v = withO v $ \o -> Description <$>+ o .: "name" <*>+ o .: "description" <*>+ o .: "games" <*>+ o .: "pokemon" <*>+ getMetadata o++instance FromJSON MetaDescription where+ parseJSON v = withO v $ \o -> MetaDescription <$>+ o .: "name" <*>+ (getResource <$> o .: "resource_uri")+++-- }}}+-- Game {{{+data MetaGame = MetaGame { mGameName :: String, getGame :: IO Game }+instance Show MetaGame where+ show set = "<MetaGame - " ++ mGameName set ++ ">"++data Game = Game {+ gameName :: String,+ gameGeneration :: Word,+ gameReleaseYear :: Word,+ gameMetadata :: MetaData+ } deriving Show++instance FromJSON MetaGame where+ parseJSON v = withO v $ \o -> MetaGame <$>+ o .: "name" <*> (getResource <$> o .: "resource_uri")++instance FromJSON Game where+ parseJSON v = withO v $ \o -> Game <$>+ o .: "name"<*>+ o .: "generation" <*>+ o .: "release_year" <*>+ getMetadata o+-- }}}+-- Sprite {{{+data MetaSprite = MetaSprite { mSpriteName :: String, getSprite :: IO Sprite }+instance Show MetaSprite where+ show set = "<MetaSprite - " ++ mSpriteName set ++ ">"++data Sprite = Sprite {+ spriteName :: String,+ spritePokemon :: MetaPokemon,+ spriteImage :: String -- Just a plain URI+ } deriving Show++instance FromJSON MetaSprite where+ parseJSON v = withO v $ \o -> MetaSprite <$>+ o .: "name" <*>+ (getResource <$> o .: "resource_uri")++instance FromJSON Sprite where+ parseJSON v = withO v $ \o -> Sprite <$>+ o .: "name" <*>+ o .: "pokemon" <*>+ o .: "image"+-- }}}
+ src/Haskmon/Types/MetaData.hs view
@@ -0,0 +1,18 @@+module Haskmon.Types.MetaData(+ module Haskmon.Types.MetaData,+ I.MetaData+) where++import Data.Word+import Data.Time.Clock+import Haskmon.Types.Internals(MetaData)+import qualified Haskmon.Types.Internals as I++resourceUri :: MetaData -> String+resourceUri = I.resourceUri++created :: MetaData -> UTCTime+created = I.created++modified :: MetaData -> UTCTime+modified = I.modified
+ src/Haskmon/Types/Move.hs view
@@ -0,0 +1,34 @@+module Haskmon.Types.Move(+ module Haskmon.Types.Move,+ I.Move, I.MetaMove+) where++import Data.Word+import Haskmon.Types.Internals(MetaData, MetaMove, Move, MetaMoveLearnType)+import qualified Haskmon.Types.Internals as I++mMoveName :: MetaMove -> String+mMoveName = I.mMoveName++mMoveLearnType :: MetaMove -> MetaMoveLearnType+mMoveLearnType = I.mMoveLearnType++getMove :: MetaMove -> IO Move+getMove = I.getMove+++moveName :: Move -> String+moveName = I.moveName++movePower :: Move -> Word+movePower = I.movePower++movePp :: Move -> Word+movePp = I.movePp++moveAccuracy :: Move -> Word+moveAccuracy = I.moveAccuracy++moveMetadata :: Move -> MetaData+moveMetadata = I.moveMetadata+
+ src/Haskmon/Types/Pokemon.hs view
@@ -0,0 +1,83 @@+module Haskmon.Types.Pokemon(+ module Haskmon.Types.Pokemon,+ I.Pokemon, I.Pokedex, I.MetaPokemon+) where++import Data.Word+import Haskmon.Types.Internals(MetaData,+ MetaPokemon,+ MetaAbility,+ MetaMove,+ MetaType,+ MetaSprite,+ MetaEggGroup,+ MetaDescription,+ Pokedex,+ Pokemon)+import qualified Haskmon.Types.Internals as I++-- Pokedex+pokedexName :: Pokedex -> String+pokedexName = I.pokedexName++pokedexPokemons :: Pokedex -> [MetaPokemon]+pokedexPokemons = I.pokedexPokemons++-- MetaPokemon+mPokemonName :: MetaPokemon -> String+mPokemonName = I.mPokemonName++getPokemon :: MetaPokemon -> IO Pokemon+getPokemon = I.getPokemon++-- Pokemon+pokemonName :: Pokemon -> String+pokemonName = I.pokemonName++pokemonNationalId :: Pokemon -> Word+pokemonNationalId = I.pokemonNationalId++pokemonAbilities :: Pokemon -> [MetaAbility]+pokemonAbilities = I.pokemonAbilities++pokemonMoves :: Pokemon -> [MetaMove]+pokemonMoves = I.pokemonMoves++pokemonTypes :: Pokemon -> [MetaType]+pokemonTypes = I.pokemonTypes++pokemonEggCycle :: Pokemon -> Word+pokemonEggCycle = I.pokemonEggCycle++pokemonEggGroups :: Pokemon -> [MetaEggGroup]+pokemonEggGroups = I.pokemonEggGroups++pokemonCatchRate :: Pokemon -> Word+pokemonCatchRate = I.pokemonCatchRate++pokemonHp :: Pokemon -> Word+pokemonHp = I.pokemonHp++pokemonAttack :: Pokemon -> Word+pokemonAttack = I.pokemonAttack++pokemonDefense :: Pokemon -> Word+pokemonDefense = I.pokemonDefense++pokemonSpAtk :: Pokemon -> Word+pokemonSpAtk = I.pokemonSpAtk++pokemonSpDef :: Pokemon -> Word+pokemonSpDef = I.pokemonSpDef++pokemonSpeed :: Pokemon -> Word+pokemonSpeed = I.pokemonSpeed++pokemonSprites :: Pokemon -> [MetaSprite]+pokemonSprites = I.pokemonSprites++pokemonDescriptions :: Pokemon -> [MetaDescription]+pokemonDescriptions = I.pokemonDescriptions++pokemonMetadata :: Pokemon -> MetaData+pokemonMetadata = I.pokemonMetadata
+ src/Haskmon/Types/Sprite.hs view
@@ -0,0 +1,24 @@+module Haskmon.Types.Sprite(+ module Haskmon.Types.Sprite,+ I.Sprite, I.MetaSprite+) where++import Data.Word+import Haskmon.Types.Internals(MetaPokemon, MetaSprite, Sprite)+import qualified Haskmon.Types.Internals as I++mSpriteName :: MetaSprite -> String+mSpriteName = I.mSpriteName++getSprite :: MetaSprite -> IO Sprite+getSprite = I.getSprite+++spriteName :: Sprite -> String+spriteName = I.spriteName++spritePokemon :: Sprite -> MetaPokemon+spritePokemon = I.spritePokemon++spriteImage :: Sprite -> String+spriteImage = I.spriteImage
+ src/Haskmon/Types/Type.hs view
@@ -0,0 +1,36 @@+module Haskmon.Types.Type(+ module Haskmon.Types.Type,+ I.Type, I.MetaType+) where++import Data.Word+import Haskmon.Types.Internals(MetaData, MetaType, Type)+import qualified Haskmon.Types.Internals as I++mTypeName :: MetaType -> String+mTypeName = I.mTypeName++getType :: MetaType -> IO Type+getType = I.getType++typeName :: Type -> String+typeName = I.typeName++typeIneffective :: Type -> [Type]+typeIneffective = I.typeIneffective++typeNoEffect :: Type -> [Type]+typeNoEffect = I.typeNoEffect++typeResistance :: Type -> [Type]+typeResistance = I.typeResistance++typeSuperEffective :: Type -> [Type]+typeSuperEffective = I.typeSuperEffective++typeWeakness :: Type -> [Type]+typeWeakness = I.typeWeakness++typeMetadata :: Type -> MetaData+typeMetadata = I.typeMetadata+