Skip to content

Commit

Permalink
Merge d63a7eb into 298db9a
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Jul 21, 2018
2 parents 298db9a + d63a7eb commit 9c62a0f
Show file tree
Hide file tree
Showing 20 changed files with 55 additions and 150 deletions.
13 changes: 0 additions & 13 deletions .leaf.yml

This file was deleted.

72 changes: 18 additions & 54 deletions .travis.yml
@@ -1,61 +1,25 @@
# DO NOT EDIT: This file was generated using the following command:
# github-tools/tools/expand-yaml hs-toxcore/.leaf.yml hs-toxcore/.travis.yml
---
addons:
apt:
packages:
- libsodium-dev
- alex-3.1.7
- happy-1.19.5
- cabal-install-1.18
- ghc-7.8.4
sources:
- sourceline: ppa:chris-lea/libsodium
- hvr-ghc
after_script:
- rm -f $HOME/.cabal && ln -s $HOME/.cabal-tools $HOME/.cabal
- rm -f $HOME/.ghc && ln -s $HOME/.ghc-tools $HOME/.ghc
- hpc-coveralls hstox-0.0.1
branches:
only:
- master
language: generic

cache:
directories:
- $HOME/.cabal-build
- $HOME/.cabal-tools
- $HOME/.ghc-build
- $HOME/.ghc-tools
env: CABALVER=1.18 GHCVER=7.8.4
- $HOME/.local
- $HOME/.stack

before_install:
- export PATH=$HOME/.local/bin:$PATH
- travis_retry curl -L https://github.com/TokTok/hs-tools/releases/download/v0.1/hs-tools-v0.1.tar.gz | tar xz -C $HOME

install:
- export PATH=$HOME/.cabal/bin:$PATH
- export PATH=$HOME/.cabal-build/bin:$PATH
- export PATH=$HOME/.cabal-tools/bin:$PATH
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/alex/3.1.7/bin:/opt/happy/1.19.5/bin:$PATH
- rm -rf $HOME/.cabal $HOME/.ghc
- mkdir -p $HOME/.cabal-tools $HOME/.ghc-tools
- rm -f $HOME/.cabal && ln -s $HOME/.cabal-tools $HOME/.cabal
- rm -f $HOME/.ghc && ln -s $HOME/.ghc-tools $HOME/.ghc
- cabal update
- mkdir -p $HOME/.cabal-build $HOME/.ghc-build
- rm -f $HOME/.cabal && ln -s $HOME/.cabal-build $HOME/.cabal
- rm -f $HOME/.ghc && ln -s $HOME/.ghc-build $HOME/.ghc
- cabal update
language: generic
# Where to find libraries.
- export LD_LIBRARY_PATH=$HOME/.local/lib
- export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig
# libsodium
- git clone --depth=1 --branch=stable https://github.com/jedisct1/libsodium
- test -f $HOME/.local/lib/libsodium.so || (cd libsodium && ./configure --prefix=$HOME/.local && make install -j$(nproc))

script:
- rm -f $HOME/.cabal && ln -s $HOME/.cabal-tools $HOME/.cabal
- rm -f $HOME/.ghc && ln -s $HOME/.ghc-tools $HOME/.ghc
- cabal install hpc-coveralls stylish-haskell hlint yaml-0.8.27 aeson-0.9.0.1
- curl https://raw.githubusercontent.com/TokTok/toktok-stack/master/tools/stylish-haskell-lhs
-o $HOME/.cabal/bin/stylish-haskell-lhs
- chmod +x $HOME/.cabal/bin/stylish-haskell-lhs
- hlint .
- stylish-haskell-lhs -i .
- git diff --exit-code
- rm -f $HOME/.cabal && ln -s $HOME/.cabal-build $HOME/.cabal
- rm -f $HOME/.ghc && ln -s $HOME/.ghc-build $HOME/.ghc
- cabal install --enable-tests --enable-benchmarks --only-dependencies ./
- if [ -n "" ]; then cabal install ; fi
- cabal configure --enable-tests --enable-benchmarks --enable-library-coverage
- travis_wait cabal test
- cabal check
sudo: required
- stack --no-terminal test --coverage --extra-include-dirs=$HOME/.local/include --extra-lib-dirs=$HOME/.local/lib
- shc hstox testsuite
5 changes: 0 additions & 5 deletions .travis/env-android.sh

This file was deleted.

3 changes: 0 additions & 3 deletions .travis/env-linux.sh

This file was deleted.

3 changes: 0 additions & 3 deletions .travis/env-osx.sh

This file was deleted.

4 changes: 0 additions & 4 deletions .travis/env.sh

This file was deleted.

6 changes: 0 additions & 6 deletions .travis/linux-after_script

This file was deleted.

13 changes: 0 additions & 13 deletions .travis/linux-install

This file was deleted.

4 changes: 0 additions & 4 deletions .travis/linux-script

This file was deleted.

5 changes: 0 additions & 5 deletions .travis/osx-install

This file was deleted.

4 changes: 0 additions & 4 deletions .travis/osx-script

This file was deleted.

22 changes: 0 additions & 22 deletions .travis/phase

This file was deleted.

1 change: 0 additions & 1 deletion appveyor.yml
Expand Up @@ -6,7 +6,6 @@ install:
- choco install ghc --version 8.2.2
- curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.16-mingw.tar.gz | tar zx
- refreshenv
- set PATH=%PATH%;C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.0.2\bin

build_script:
- cabal update
Expand Down
1 change: 0 additions & 1 deletion src/testsuite/Network/Tox/DHT/ClientListSpec.hs
@@ -1,4 +1,3 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE Trustworthy #-}
module Network.Tox.DHT.ClientListSpec where

Expand Down
7 changes: 3 additions & 4 deletions src/tox/Network/Tox/DHT/Distance.lhs
@@ -1,9 +1,8 @@
\section{Distance}

\begin{code}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE Trustworthy #-}
module Network.Tox.DHT.Distance where
import Control.Applicative ((<$>))
Expand Down Expand Up @@ -90,7 +89,7 @@ rebaseDistance a b (Distance d) =
instance Arbitrary Distance where
arbitrary = (Distance . abs) <$> arbitrary
arbitrary = Distance . abs <$> arbitrary
\end{code}

An implementation is not required to provide a Distance type, so it has no
Expand Down
2 changes: 1 addition & 1 deletion src/tox/Network/Tox/DHT/NodesRequest.lhs
Expand Up @@ -30,7 +30,7 @@ import Test.QuickCheck.Arbitrary (Arbitrary, arbitrary)
------------------------------------------------------------------------------}
data NodesRequest = NodesRequest
newtype NodesRequest = NodesRequest
{ requestedKey :: PublicKey
}
deriving (Eq, Read, Show, Generic, Typeable)
Expand Down
2 changes: 1 addition & 1 deletion src/tox/Network/Tox/DHT/NodesResponse.lhs
Expand Up @@ -37,7 +37,7 @@ import Test.QuickCheck.Arbitrary (Arbitrary, arbitrary)
------------------------------------------------------------------------------}
data NodesResponse = NodesResponse
newtype NodesResponse = NodesResponse
{ foundNodes :: [NodeInfo]
}
deriving (Eq, Read, Show, Generic, Typeable)
Expand Down
10 changes: 5 additions & 5 deletions src/tox/Network/Tox/DHT/Operation.lhs
Expand Up @@ -3,7 +3,6 @@
\begin{code}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RankNTypes #-}
Expand All @@ -12,8 +11,8 @@
{-# LANGUAGE TypeSynonymInstances #-}
module Network.Tox.DHT.Operation where
import Control.Applicative (Applicative, pure, (*>),
(<$>), (<*>))
import Control.Applicative (Applicative, pure, (<$>),
(<*>))
import Control.Monad (guard, msum, replicateM,
unless, void, when)
import Control.Monad.Identity (Identity, runIdentity)
Expand All @@ -27,6 +26,7 @@ import Control.Monad.Writer (MonadWriter, WriterT,
execWriterT, tell)
import Data.Binary (Binary)
import Data.Foldable (for_)
import Data.Functor (($>))
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe (isNothing)
Expand Down Expand Up @@ -285,7 +285,7 @@ checkNodes = modifyM $ DhtState.traverseClientLists checkNodes'
checkNode clientNode = Timed.askTime >>= \time ->
if time Time.- lastCheck < checkPeriod
then pure $ Just clientNode
else (tell [requestInfo] *>) . pure $
else (tell [requestInfo] $>) $
if checkCount + 1 < maxChecks
then Just $ clientNode
{ ClientNode.lastCheck = time
Expand Down Expand Up @@ -361,7 +361,7 @@ handleNodesRequest ::
handleNodesRequest from (RpcPacket (NodesRequest key) requestId) = do
ourPublicKey <- gets $ KeyPair.publicKey . DhtState.dhtKeyPair
when (ourPublicKey /= NodeInfo.publicKey from) $ do
nodes <- DhtState.takeClosestNodesTo responseMaxNodes key <$> get
nodes <- gets (DhtState.takeClosestNodesTo responseMaxNodes key)
unless (null nodes) $ sendNodesResponse from requestId nodes
sendPingRequestIfAppropriate from
Expand Down
1 change: 0 additions & 1 deletion src/tox/Network/Tox/NodeInfo/SocketAddress.lhs
Expand Up @@ -7,7 +7,6 @@ any internet host.
\begin{code}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE Trustworthy #-}
module Network.Tox.NodeInfo.SocketAddress where
Expand Down
27 changes: 27 additions & 0 deletions stack.yaml
@@ -0,0 +1,27 @@
packages: [.]
resolver: lts-6.27
extra-deps:
- QuickCheck-2.11.3
- base-orphans-0.5.4
- binary-conduit-1.2.5
- conduit-extra-1.2.3.2
- cpphs-1.20.8
- data-msgpack-0.0.12
- data-msgpack-types-0.0.2
- exceptions-0.10.0
- hspec-2.4.8
- hspec-core-2.4.8
- hspec-discover-2.4.8
- hspec-expectations-0.8.2
- integer-logarithms-1.0.2.1
- mmorph-1.1.2
- network-2.7.0.2
- network-msgpack-rpc-0.0.5
- parsec-3.1.13.0
- primitive-0.6.4.0
- quickcheck-io-0.2.0
- saltine-0.1.0.1
- scientific-0.3.6.2
- typed-process-0.2.2.0
- unliftio-core-0.1.1.0
- vector-0.12.0.1

0 comments on commit 9c62a0f

Please sign in to comment.