Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 187 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
# Use new container infrastructure to enable caching
sudo: false

# Choose a lightweight base image; we provide our own build tools.
language: c

# Caching so the next build will be fast too.
cache:
directories:
- $HOME/.ghc
- $HOME/.cabal
- $HOME/.stack

# The different configurations we want to test. We have BUILD=cabal which uses
# cabal-install, and BUILD=stack which uses Stack. More documentation on each
# of those below.
#
# We set the compiler values here to tell Travis to use a different
# cache file per set of arguments.
#
# If you need to have different apt packages for each combination in the
# matrix, you can use a line such as:
# addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
matrix:
include:
# We grab the appropriate GHC and cabal-install versions from hvr's PPA. See:
# https://github.com/hvr/multi-ghc-travis
#- env: BUILD=cabal GHCVER=7.0.4 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
# compiler: ": #GHC 7.0.4"
# addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
#- env: BUILD=cabal GHCVER=7.2.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
# compiler: ": #GHC 7.2.2"
# addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
#- env: BUILD=cabal GHCVER=7.4.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
# compiler: ": #GHC 7.4.2"
# addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
# - env: BUILD=cabal GHCVER=7.6.3 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
# compiler: ": #GHC 7.6.3"
# addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
# - env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 HAPPYVER=1.19.5 ALEXVER=3.1.7
# compiler: ": #GHC 7.8.4"
# addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
- env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7
compiler: ": #GHC 7.10.3"
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
- env: BUILD=cabal GHCVER=8.0.1 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
compiler: ": #GHC 8.0.1"
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}

# Build with the newest GHC and cabal-install. This is an accepted failure,
# see below.
- env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
compiler: ": #GHC HEAD"
addons: {apt: {packages: [cabal-install-head,ghc-head,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}

# The Stack builds. We can pass in arbitrary Stack arguments via the ARGS
# variable, such as using --stack-yaml to point to a different file.
- env: BUILD=stack ARGS=""
compiler: ": #stack default"
addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}

# - env: BUILD=stack ARGS="--resolver lts-2"
# compiler: ": #stack 7.8.4"
# addons: {apt: {packages: [ghc-7.8.4], sources: [hvr-ghc]}}

- env: BUILD=stack ARGS="--resolver lts-3"
compiler: ": #stack 7.10.2"
addons: {apt: {packages: [ghc-7.10.2], sources: [hvr-ghc]}}

- env: BUILD=stack ARGS="--resolver lts-5"
compiler: ": #stack 7.10.3 (lts-5)"
addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}

- env: BUILD=stack ARGS="--resolver lts-6"
compiler: ": #stack 7.10.3 (lts-6)"
addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}

# Nightly builds are allowed to fail
- env: BUILD=stack ARGS="--resolver nightly"
compiler: ": #stack nightly"
addons: {apt: {packages: [libgmp,libgmp-dev]}}

# Build on OS X in addition to Linux
- env: BUILD=stack ARGS=""
compiler: ": #stack default osx"
os: osx

# - env: BUILD=stack ARGS="--resolver lts-2"
# compiler: ": #stack 7.8.4 osx"
# os: osx

- env: BUILD=stack ARGS="--resolver lts-3"
compiler: ": #stack 7.10.2 osx"
os: osx

- env: BUILD=stack ARGS="--resolver lts-5"
compiler: ": #stack 7.10.3 (lts-5) osx"
os: osx

- env: BUILD=stack ARGS="--resolver lts-6"
compiler: ": #stack 7.10.3 (lts-6) osx"
os: osx

- env: BUILD=stack ARGS="--resolver nightly"
compiler: ": #stack nightly osx"
os: osx

allow_failures:
- env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
- env: BUILD=stack ARGS="--resolver nightly"

before_install:
# Using compiler above sets CC to an invalid value, so unset it
- unset CC

# We want to always allow newer versions of packages when building on GHC HEAD
- CABALARGS=""
- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi

# Download and unpack the stack executable
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:/opt/alex/$ALEXVER/bin:/opt/happy/$HAPPYVER/bin:$HOME/.cabal/bin:$PATH
- mkdir -p ~/.local/bin
- |
if [ `uname` = "Darwin" ]
then
travis_retry curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
else
travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
fi

# Use the more reliable S3 mirror of Hackage
mkdir -p $HOME/.cabal
echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config
echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config

if [ "$CABALVER" != "1.16" ]
then
echo 'jobs: $ncpus' >> $HOME/.cabal/config
fi

# Get the list of packages from the stack.yaml file
- PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')

install:
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
- if [ -f configure.ac ]; then autoreconf -i; fi
- |
set -ex
case "$BUILD" in
stack)
# stack --no-terminal --install-ghc $ARGS test --bench --only-dependencies
stack --no-terminal --install-ghc $ARGS build --bench --only-dependencies
;;
cabal)
cabal --version
travis_retry cabal update
# cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
cabal install --only-dependencies --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
;;
esac
set +ex

script:
- |
set -ex
case "$BUILD" in
stack)
# stack --no-terminal $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps
stack --no-terminal $ARGS build --bench --no-run-benchmarks --haddock --no-haddock-deps
;;
cabal)
# cabal install --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
cabal install --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES

ORIGDIR=$(pwd)
for dir in $PACKAGES
do
cd $dir
cabal check || [ "$CABALVER" == "1.16" ]
cabal sdist
SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && \
(cd dist && cabal install --force-reinstalls "$SRC_TGZ")
cd $ORIGDIR
done
;;
esac
set +ex
Empty file removed README
Empty file.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# fb [![Hackage](https://img.shields.io/hackage/v/fb.svg?style=flat)](https://hackage.haskell.org/package/fb) [![Build Status](https://travis-ci.org/prowdsponsor/fb.png)](https://travis-ci.org/prowdsponsor/fb)

Haskell library for accessing Facebook's API.
58 changes: 30 additions & 28 deletions fb.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ description:
(<https://github.com/prowdsponsor/fb/issues>).

extra-source-files:
README.md
tests/Main.hs
tests/tryIt.hs
example.hs
Expand All @@ -50,45 +51,46 @@ library
exposed-modules:
Facebook
other-modules:
Facebook.Types
Facebook.Monad
Facebook.Base
Facebook.Auth
Facebook.Pager
Facebook.Base
Facebook.FQL
Facebook.Graph
Facebook.Monad
Facebook.Object.Action
Facebook.Object.FriendList
Facebook.Object.Checkin
Facebook.Object.User
Facebook.Object.Page
Facebook.Object.FriendList
Facebook.Object.Order
Facebook.Object.Page
Facebook.Object.User
Facebook.Pager
Facebook.RealTime
Facebook.FQL
Facebook.TestUsers
Facebook.Types
build-depends:
base >= 4 && < 5
, lifted-base >= 0.1 && < 0.3
, bytestring >= 0.9 && < 0.11
, text >= 0.11 && < 1.3
, transformers >= 0.2 && < 0.6
, transformers-base
, monad-control
, resourcet
, data-default
, http-types
, http-conduit >= 2.0 && < 2.2
, attoparsec >= 0.10.4 && < 0.14
, unordered-containers
, aeson >= 0.5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be bumped up to aeson >= 0.7 since that is when the function encodeToTextBuilder was introduced (which you use in this PR)

, attoparsec >= 0.10.4 && < 0.14
, base16-bytestring >= 0.1
, base64-bytestring >= 0.1.1
, time >= 1.2 && < 1.7
, old-locale
, bytestring >= 0.9 && < 0.11
, cereal >= 0.3 && < 0.6
, crypto-api >= 0.11 && < 0.14
, cryptohash >= 0.7
, cryptohash-cryptoapi == 0.1.*
, data-default
, exceptions
, http-conduit >= 2.0 && < 2.2
, http-types
, lifted-base >= 0.1 && < 0.3
, monad-control
, monad-logger >= 0.3
, old-locale
, resourcet
, text >= 0.11 && < 1.3
, time >= 1.2 && < 1.7
, transformers >= 0.2 && < 0.6
, transformers-base
, unordered-containers
if flag(conduit11)
build-depends:
conduit >= 1.1 && < 1.3
Expand All @@ -100,14 +102,14 @@ library
extensions:
DeriveDataTypeable
EmptyDataDecls
OverloadedStrings
FlexibleInstances
GADTs
StandaloneDeriving
ScopedTypeVariables
GeneralizedNewtypeDeriving
TypeFamilies
FlexibleInstances
MultiParamTypeClasses
OverloadedStrings
ScopedTypeVariables
StandaloneDeriving
TypeFamilies
if flag(debug)
cpp-options: -DDEBUG

Expand All @@ -128,7 +130,7 @@ test-suite runtests
, data-default
, HUnit
, QuickCheck
, hspec >= 1.9 && < 1.12
, hspec >= 1.9
, fb
extensions:
TypeFamilies
Expand Down
3 changes: 1 addition & 2 deletions src/Facebook/Auth.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module Facebook.Auth
, DebugToken(..)
) where

import Control.Applicative
import Control.Monad (guard, join, liftM, mzero)
import Control.Monad.IO.Class (MonadIO(liftIO))
import Control.Monad.Trans.Control (MonadBaseControl)
Expand All @@ -35,7 +34,7 @@ import qualified Control.Exception.Lifted as E
import qualified Control.Monad.Trans.Resource as R
import qualified Data.Aeson as AE
import qualified Data.Aeson.Types as AE
import qualified Data.Attoparsec.Char8 as AB
import qualified Data.Attoparsec.ByteString.Char8 as AB
import qualified Data.Attoparsec.Text as A
import qualified Data.ByteString as B
import qualified Data.ByteString.Base64.URL as Base64URL
Expand Down
2 changes: 1 addition & 1 deletion src/Facebook/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Control.Monad.Trans.Class (MonadTrans)
import Control.Monad.Trans.Control (MonadBaseControl)
import qualified Control.Monad.Trans.Resource as R
import qualified Data.Aeson as A
import qualified Data.Attoparsec.Char8 as AT
import qualified Data.Attoparsec.ByteString.Char8 as AT
import qualified Data.ByteString as B
import qualified Data.Conduit as C
import qualified Data.Conduit.Attoparsec as C
Expand Down
2 changes: 0 additions & 2 deletions src/Facebook/FQL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ module Facebook.FQL
, FQLObject(..)
) where

import Control.Applicative((<$>))
import Control.Monad.Trans.Control (MonadBaseControl)
import Data.Monoid (mempty)
import Data.Text (Text)
import Data.Time (UTCTime)
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
Expand Down
8 changes: 3 additions & 5 deletions src/Facebook/Graph.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ module Facebook.Graph
, Tag(..)
) where


import Control.Applicative
import Control.Monad (mzero)
import Control.Monad.Trans.Control (MonadBaseControl)
import Data.ByteString.Char8 (ByteString)
import Data.Int (Int8, Int16, Int32, Int64)
import Data.List (intersperse)
import Data.Text (Text)
import Data.Typeable (Typeable)
import Data.Word (Word, Word8, Word16, Word32, Word64)
import Data.Word (Word8, Word16, Word32, Word64)
#if MIN_VERSION_time(1,5,0)
import Data.Time (defaultTimeLocale)
#else
Expand All @@ -30,7 +28,7 @@ import System.Locale (defaultTimeLocale)

import qualified Control.Monad.Trans.Resource as R
import qualified Data.Aeson as A
import qualified Data.Aeson.Encode as AE (fromValue)
import qualified Data.Aeson.Encode as AE (encodeToTextBuilder)
import qualified Data.ByteString.Char8 as B
import qualified Data.Text.Encoding as TE
import qualified Data.Text.Lazy as TL
Expand Down Expand Up @@ -258,7 +256,7 @@ instance SimpleType GeoCoordinates where
encodeFbParam c =
let obj = A.object [ "latitude" A..= latitude c
, "longitude" A..= longitude c]
toBS = TE.encodeUtf8 . TL.toStrict . TLB.toLazyText . AE.fromValue
toBS = TE.encodeUtf8 . TL.toStrict . TLB.toLazyText . AE.encodeToTextBuilder
in toBS obj


Expand Down
2 changes: 1 addition & 1 deletion src/Facebook/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module Facebook.Monad
, lift
) where

import Control.Applicative (Applicative, Alternative)
import Control.Applicative (Alternative)
import Control.Monad (MonadPlus, liftM)
import Control.Monad.Base (MonadBase(..))
import Control.Monad.Fix (MonadFix)
Expand Down
1 change: 0 additions & 1 deletion src/Facebook/Object/Checkin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Facebook.Object.Checkin
, createCheckin
) where

import Control.Applicative
import Control.Monad (mzero)
import Control.Monad.Trans.Control (MonadBaseControl)
import Data.Aeson ((.:), (.:?))
Expand Down
1 change: 0 additions & 1 deletion src/Facebook/Object/FriendList.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Facebook.Object.FriendList
, getFriendListMembers
) where

import Control.Applicative
import Control.Monad (mzero)
import Control.Monad.Trans.Control (MonadBaseControl)
import Data.Aeson ((.:))
Expand Down
Loading