twitter-types 0.5.0 → 0.6.0
raw patch · 6 files changed
+1/−527 lines, 6 filesdep −http-typesdep ~aeson
Dependencies removed: http-types
Dependency ranges changed: aeson
Files
- .gitignore +0/−30
- .travis.yml +0/−52
- Web/Twitter/Types/Lens.hs +0/−355
- Web/Twitter/Types/Lens/TH.hs +0/−62
- Web/Twitter/Types/Lens/Types.hs +0/−14
- twitter-types.cabal +1/−14
− .gitignore
@@ -1,30 +0,0 @@-# General-\#*#-.*~-*~-.#*-*.swp-.DS_Store-.gdb_history-TAGS-# Object files, etc-*.a-*.o-*.so-*.hi-*.p_hi-*.chi-*.chs.h-*.tix-.hpc-a.out-# autotool-autom4te.cache-stamp-h1-# misc-*.sqlite-Main-dist/-cabal-dev/-.cabal-sandbox/-cabal.sandbox.config
− .travis.yml
@@ -1,52 +0,0 @@-language: haskell--env:- matrix:- - GHCVER=7.4.2- - GHCVER=7.6.3- - GHCVER=7.8.3 USE_COVERALLS=1- - GHCVER=head--matrix:- allow_failures:- - env: GHCVER=7.4.2- - env: GHCVER=head--before_install:- - |- if [ $GHCVER = `ghc --numeric-version` ]; then- echo "use system ghc: `which ghc` `ghc --numeric-version`"- else- travis_retry sudo add-apt-repository -y ppa:hvr/ghc- travis_retry sudo apt-get update- travis_retry sudo apt-get install -y --force-yes cabal-install-1.18 ghc-$GHCVER- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/1.18/bin:$PATH- echo "use ppa:hvr/ghc: `which ghc` `ghc --numeric-version`"- fi--install:- - export PATH=$HOME/.cabal/bin:$PATH- - which cabal- - travis_retry cabal update- - cabal install happy- - cabal install --only-dependencies --enable-tests- - "[ -n \"$USE_COVERALLS\" ] && travis_retry cabal install hpc-coveralls || true"- - ghc-pkg list--script:- - |- if [ -n "$USE_COVERALLS" ]; then- cabal configure --enable-tests --enable-library-coverage $CABAL_FLAGS- else- cabal configure --enable-tests $CABAL_FLAGS- fi- - cabal build- - |- if [ -n "$USE_COVERALLS" ]; then- run-cabal-test --show-details=always- else- cabal test --show-details=always- fi--after_script:- - "[ -n \"$USE_COVERALLS\" ] && hpc-coveralls --exclude-dir=tests tests || true"
− Web/Twitter/Types/Lens.hs
@@ -1,355 +0,0 @@-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE OverloadedStrings, DeriveDataTypeable, RankNTypes, CPP, FlexibleInstances #-}--module Web.Twitter.Types.Lens- (- -- * Type classes- AsStatus(..)- , AsUser(..)- , HasCreatedAt(..)- , AsImageSize(..)-- -- * 'TT.Status'- , TT.Status- , statusContributors- , statusCoordinates- , statusCreatedAt- , statusCurrentUserRetweet- , statusEntities- , statusExtendedEntities- , statusFavoriteCount- , statusFavorited- , statusFilterLevel- , statusId- , statusInReplyToScreenName- , statusInReplyToStatusId- , statusInReplyToUserId- , statusLang- , statusPlace- , statusPossiblySensitive- , statusScopes- , statusRetweetCount- , statusRetweeted- , statusRetweetedStatus- , statusSource- , statusText- , statusTruncated- , statusUser- , statusWithheldCopyright- , statusWithheldInCountries- , statusWithheldScope-- -- * 'TT.SearchResult'- , TT.SearchResult- , searchResultStatuses- , searchResultSearchMetadata-- -- * 'TT.SearchStatus'- , TT.SearchStatus- , searchStatusCreatedAt- , searchStatusId- , searchStatusText- , searchStatusSource- , searchStatusUser- , searchStatusCoordinates-- -- * 'TT.SearchMetadata'- , TT.SearchMetadata- , searchMetadataMaxId- , searchMetadataSinceId- , searchMetadataRefreshURL- , searchMetadataNextResults- , searchMetadataCount- , searchMetadataCompletedIn- , searchMetadataSinceIdStr- , searchMetadataQuery- , searchMetadataMaxIdStr-- -- * 'TT.RetweetedStatus'- , TT.RetweetedStatus- , rsCreatedAt- , rsId- , rsText- , rsSource- , rsTruncated- , rsEntities- , rsUser- , rsRetweetedStatus- , rsCoordinates-- -- * 'TT.DirectMessage'- , TT.DirectMessage- , dmCreatedAt- , dmSenderScreenName- , dmSender- , dmText- , dmRecipientScreeName- , dmId- , dmRecipient- , dmRecipientId- , dmSenderId- , dmCoordinates-- -- * 'TT.Event'- , TT.Event- , evCreatedAt- , evTargetObject- , evEvent- , evTarget- , evSource-- -- * 'TT.Delete'- , TT.Delete- , delId- , delUserId-- -- * 'TT.User'- , TT.User- , userContributorsEnabled- , userCreatedAt- , userDefaultProfile- , userDefaultProfileImage- , userDescription- , userFavoritesCount- , userFollowRequestSent- , userFollowing- , userFollowersCount- , userFriendsCount- , userGeoEnabled- , userId- , userIsTranslator- , userLang- , userListedCount- , userLocation- , userName- , userNotifications- , userProfileBackgroundColor- , userProfileBackgroundImageURL- , userProfileBackgroundImageURLHttps- , userProfileBackgroundTile- , userProfileBannerURL- , userProfileImageURL- , userProfileImageURLHttps- , userProfileLinkColor- , userProfileSidebarBorderColor- , userProfileSidebarFillColor- , userProfileTextColor- , userProfileUseBackgroundImage- , userProtected- , userScreenName- , userShowAllInlineMedia- , userStatusesCount- , userTimeZone- , userURL- , userUtcOffset- , userVerified- , userWithheldInCountries- , userWithheldScope-- -- * 'TT.List'- , TT.List- , listId- , listName- , listFullName- , listMemberCount- , listSubscriberCount- , listMode- , listUser-- -- * 'TT.Entities'- , TT.Entities- , enHashTags- , enUserMentions- , enURLs- , enMedia-- -- * 'TT.Entity'- , TT.Entity- , entityBody- , entityIndices-- -- * 'TT.HashTagEntity'- , TT.HashTagEntity- , hashTagText-- -- * 'TT.UserEntity'- , TT.UserEntity- , userEntityUserId- , userEntityUserName- , userEntityUserScreenName-- -- * 'TT.URLEntity'- , TT.URLEntity- , ueURL- , ueExpanded- , ueDisplay-- -- * 'TT.MediaEntity'- , TT.MediaEntity- , meType- , meId- , meSizes- , meMediaURL- , meMediaURLHttps- , meURL-- -- * 'TT.MediaSize'- , TT.MediaSize- , msWidth- , msHeight- , msResize-- -- * 'TT.Coordinates'- , TT.Coordinates- , coordinates- , coordinatesType-- -- * 'TT.Place'- , TT.Place- , placeAttributes- , placeBoundingBox- , placeCountry- , placeCountryCode- , placeFullName- , placeId- , placeName- , placeType- , placeURL-- -- * 'TT.BoundingBox'- , TT.BoundingBox- , boundingBoxCoordinates- , boundingBoxType-- -- * 'TT.Contributor'- , TT.Contributor- , contributorId- , contributorScreenName-- -- * 'TT.UploadedMedia'- , TT.UploadedMedia- , uploadedMediaId- , uploadedMediaSize- , uploadedMediaImage-- -- * 'TT.ImageSizeType'- , TT.ImageSizeType- , imageSizeTypeWidth- , imageSizeTypeHeight- , imageSizeTypeType-- -- * Type aliases and sum types- , TT.DateString- , TT.UserId- , TT.Friends- , TT.URIString- , TT.UserName- , TT.StatusId- , TT.LanguageCode- , TT.StreamingAPI(..)- , TT.EventTarget(..)- , TT.EntityIndices- )- where--import Web.Twitter.Types.Lens.Types-import qualified Web.Twitter.Types as TT-import Data.Text (Text)-import Web.Twitter.Types.Lens.TH--makeLenses ''TT.Status-makeLenses ''TT.SearchResult-makeLenses ''TT.SearchStatus-makeLenses ''TT.SearchMetadata-makeLenses ''TT.RetweetedStatus-makeLenses ''TT.DirectMessage-makeLenses ''TT.Event-makeLenses ''TT.Delete-makeLenses ''TT.User-makeLenses ''TT.List-makeLenses ''TT.Entities-makeLenses ''TT.Entity-makeLenses ''TT.HashTagEntity-makeLenses ''TT.UserEntity-makeLenses ''TT.URLEntity-makeLenses ''TT.MediaEntity-makeLenses ''TT.MediaSize-makeLenses ''TT.Coordinates-makeLenses ''TT.Place-makeLenses ''TT.BoundingBox-makeLenses ''TT.Contributor-makeLenses ''TT.ImageSizeType-makeLenses ''TT.UploadedMedia--class AsStatus s where- status_id :: Lens' s TT.StatusId- text :: Lens' s Text- user :: Lens' s TT.User- geolocation :: Lens' s (Maybe TT.Coordinates)--instance AsStatus TT.Status where- status_id = statusId- text = statusText- user = statusUser- geolocation = statusCoordinates--instance AsStatus TT.SearchStatus where- status_id = searchStatusId- text = searchStatusText- user = searchStatusUser- geolocation = searchStatusCoordinates--instance AsStatus TT.RetweetedStatus where- status_id = rsId- text = rsText- user = rsUser- geolocation = rsCoordinates--instance AsStatus TT.DirectMessage where- status_id = dmId- text = dmText- user = dmSender- geolocation = dmCoordinates--class AsUser u where- user_id :: Lens' u TT.UserId- name :: Lens' u TT.UserName- screen_name :: Lens' u Text--instance AsUser TT.User where- user_id = userId- name = userName- screen_name = userScreenName--instance AsUser TT.UserEntity where- user_id = userEntityUserId- name = userEntityUserName- screen_name = userEntityUserScreenName--instance AsUser (TT.Entity TT.UserEntity) where- user_id = entityBody.userEntityUserId- name = entityBody.userEntityUserName- screen_name = entityBody.userEntityUserScreenName--class HasCreatedAt a where- created_at :: Lens' a TT.DateString-instance HasCreatedAt TT.Status where- created_at = statusCreatedAt-instance HasCreatedAt TT.SearchStatus where- created_at = searchStatusCreatedAt-instance HasCreatedAt TT.RetweetedStatus where- created_at = rsCreatedAt-instance HasCreatedAt TT.DirectMessage where- created_at = dmCreatedAt-instance HasCreatedAt TT.User where- created_at = userCreatedAt--class AsImageSize a where- width :: Lens' a Int- height :: Lens' a Int-instance AsImageSize TT.MediaSize where- width = msWidth- height = msHeight-instance AsImageSize TT.ImageSizeType where- width = imageSizeTypeWidth- height = imageSizeTypeHeight
− Web/Twitter/Types/Lens/TH.hs
@@ -1,62 +0,0 @@-{-# LANGUAGE QuasiQuotes #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE RankNTypes #-}-{-# LANGUAGE CPP #-}--module Web.Twitter.Types.Lens.TH- where--import Language.Haskell.TH-import Language.Haskell.TH.Syntax-import Web.Twitter.Types.Lens.Types--makeLenses :: Name -> Q [Dec]-makeLenses typename = do- typeinfo <- reify typename- case typeinfo of- TyConI (DataD _cxt _name tyVarBndr [RecC _dataConName fields] _names) ->- makeFieldLenses typename tyVarBndr fields- _ -> error $ "unknown type info: reify " ++ show typename--makeFieldLenses :: Name -> [TyVarBndr] -> [VarStrictType] -> Q [Dec]-makeFieldLenses tyConName tyVarBndr fields = do- fieldsDec <- mapM (eachField tyConName tyVarBndr) fields- return $ concat fieldsDec--eachField :: Name -> [TyVarBndr] -> (Name, Strict, Type) -> Q [Dec]-eachField tyConName tyVarBndr (fieldName, _, fieldType) = do- let funN = mkName (nameBase fieldName)- sigdef <- eachFieldSigD funN tyConName tyVarBndr fieldType- f <- newName "f"- record <- newName "record"- newVal <- newName "newVal"- recUpdVal <- varE newVal- let expr = [|fmap|]- `appE` (lamE [varP newVal] (recUpdE (varE record) [return (fieldName, recUpdVal)]))- `appE` (varE f `appE` (varE fieldName `appE` varE record))- bind <- funD funN [clause [varP f, varP record] (normalB expr) []]-#if MIN_VERSION_template_haskell(2,8,0)- -- GHC 7.6- pragD <- pragInlD funN Inline FunLike AllPhases- return [sigdef, bind, pragD]-#elif MIN_VERSION_template_haskell(2,6,0)- -- GHC 7.4- pragD <- pragInlD funN (inlineSpecNoPhase True False)- return [sigdef, bind, pragD]-#else- return [sigdef, bind]-#endif--eachFieldSigD :: Name -> Name -> [TyVarBndr] -> Type -> DecQ-eachFieldSigD funN tyConName [_] (VarT _fieldTypeVal) = do- a <- newName "a"- b <- newName "b"- let typ = forallT [PlainTV a, PlainTV b] (return []) (conT ''Lens `appT` (conT tyConName `appT` varT a) `appT` (conT tyConName `appT` varT b) `appT` varT a `appT` varT b)- sigD funN typ-eachFieldSigD funN tyConName [PlainTV a] fieldType = do- let typ = forallT [PlainTV a] (return []) (conT ''Lens' `appT` (conT tyConName `appT` varT a) `appT` return fieldType)- sigD funN typ-eachFieldSigD funN tyConName [] fieldType = do- sigD funN (conT ''Lens' `appT` conT tyConName `appT` return fieldType)-eachFieldSigD funN tyConName tyVarBndr fieldType =- error $ "Unknown TH : " ++ show funN ++ " " ++ show tyConName ++ " " ++ show tyVarBndr ++ " " ++ show fieldType
− Web/Twitter/Types/Lens/Types.hs
@@ -1,14 +0,0 @@-{-# LANGUAGE RankNTypes #-}--module Web.Twitter.Types.Lens.Types- ( Lens- , Lens'- ) where---- | A type alias of the lens.--- It is the same definition as the lens which introduced in--- <http://hackage.haskell.org/package/lens-4.3.3/docs/Control-Lens-Type.html#t:Lens>-type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t---- | Same as Lens' <http://hackage.haskell.org/package/lens-4.3.3/docs/Control-Lens-Type.html#t:Lens-39->-type Lens' s a = Lens s s a a
twitter-types.cabal view
@@ -1,5 +1,5 @@ name: twitter-types-version: 0.5.0+version: 0.6.0 license: BSD3 license-file: LICENSE author: Takahiro HIMURA@@ -12,10 +12,6 @@ build-type: Simple homepage: https://github.com/himura/twitter-types -extra-source-files:- .gitignore- .travis.yml- source-repository head type: git location: git://github.com/himura/twitter-types.git@@ -25,21 +21,13 @@ build-depends: base >= 4 && < 5- , http-types , aeson >= 0.3.2.2 , text , unordered-containers- , template-haskell exposed-modules: Web.Twitter.Types- Web.Twitter.Types.Lens- -- for documentation- Web.Twitter.Types.Lens.Types - other-modules:- Web.Twitter.Types.Lens.TH- test-suite tests type: exitcode-stdio-1.0 hs-source-dirs: tests, .@@ -51,7 +39,6 @@ , test-framework-th-prime , test-framework-hunit , HUnit- , http-types , aeson , attoparsec , bytestring