Skip to content

Updates for PureScript 0.9.1 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2016
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 7 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
language: node_js
sudo: false
node_js:
- 5
dist: trusty
sudo: required
node_js: 6
install:
- npm install -g bower
- npm install
- bower install
script:
- npm run build
- npm run -s build
after_success:
- >-
test $TRAVIS_TAG &&
psc-publish > .pursuit.json &&
curl -X POST http://pursuit.purescript.org/packages \
-d @.pursuit.json \
-H 'Accept: application/json' \
-H "Authorization: token ${GITHUB_TOKEN}"
echo $GITHUB_TOKEN | pulp login &&
echo y | pulp publish --no-push
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Latest release](http://img.shields.io/bower/v/purescript-http-methods.svg)](https://github.com/purescript-contrib/purescript-http-methods/releases)
[![Build Status](https://travis-ci.org/purescript-contrib/purescript-http-methods.svg?branch=master)](https://travis-ci.org/purescript-contrib/purescript-http-methods)
[![Dependency Status](https://www.versioneye.com/user/projects/57558c637757a00041b3a750/badge.svg?style=flat)](https://www.versioneye.com/user/projects/57558c637757a00041b3a750)
[![Maintainer: garyb](https://img.shields.io/badge/maintainer-garyb-lightgrey.svg)](http://github.com/garyb)

HTTP method type.
Expand Down
7 changes: 3 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
"package.json"
],
"dependencies": {
"purescript-either": "^0.2.3",
"purescript-generics": "^0.7.2",
"purescript-prelude": "^0.1.4",
"purescript-strings": "^0.7.1"
"purescript-either": "^1.0.0",
"purescript-generics": "^1.0.0",
"purescript-strings": "^1.0.0"
}
}
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"private": true,
"scripts": {
"postinstall": "pulp dep install",
"clean": "rimraf output && rimraf .pulp-cache",
"build": "pulp build"
"build": "pulp build --censor-lib --strict",
"test": "pulp test"
},
"devDependencies": {
"pulp": "^8.0.0",
"purescript": "^0.7.6",
"pulp": "^9.0.0",
"purescript-psa": "^0.3.9",
"purescript": "^0.9.1",
"rimraf": "^2.5.0"
}
}
44 changes: 10 additions & 34 deletions src/Data/HTTP/Method.purs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module Data.HTTP.Method
( Method(..)
, CustomMethod()
, runCustomMethod
, CustomMethod
, unCustomMethod
, fromString
, print
) where

import Prelude

import Data.Either (Either(..), either)
import Data.Generic (Generic, gCompare)
import Data.Generic (class Generic)
import Data.String as Str

data Method
Expand All @@ -35,30 +35,10 @@ data Method
-- RFC5789
| PATCH

derive instance eqMethod :: Eq Method
derive instance ordMethod :: Ord Method
derive instance genericMethod :: Generic Method

instance eqMethod :: Eq Method where
eq OPTIONS OPTIONS = true
eq GET GET = true
eq HEAD HEAD = true
eq POST POST = true
eq PUT PUT = true
eq DELETE DELETE = true
eq TRACE TRACE = true
eq CONNECT CONNECT = true
eq PROPFIND PROPFIND = true
eq PROPPATCH PROPPATCH = true
eq MKCOL MKCOL = true
eq COPY COPY = true
eq MOVE MOVE = true
eq LOCK LOCK = true
eq UNLOCK UNLOCK = true
eq PATCH PATCH = true
eq _ _ = false

instance ordMethod :: Ord Method where
compare = gCompare

instance showMethod :: Show Method where
show OPTIONS = "OPTIONS"
show GET = "GET"
Expand All @@ -79,17 +59,13 @@ instance showMethod :: Show Method where

newtype CustomMethod = CustomMethod String

runCustomMethod :: CustomMethod -> String
runCustomMethod (CustomMethod m) = m
unCustomMethod :: CustomMethod -> String
unCustomMethod (CustomMethod m) = m

derive instance eqCustomMethod :: Eq CustomMethod
derive instance ordCustomMethod :: Ord CustomMethod
derive instance genericCustomMethod :: Generic CustomMethod

instance eqCustomMethod :: Eq CustomMethod where
eq (CustomMethod m1) (CustomMethod m2) = m1 == m2

instance ordCustomMethod :: Ord CustomMethod where
compare = gCompare

instance showCustomMethod :: Show CustomMethod where
show (CustomMethod m) = "(CustomMethod " <> show m <> ")"

Expand All @@ -114,4 +90,4 @@ fromString s =
m -> Right (CustomMethod m)

print :: Either Method CustomMethod -> String
print = either show runCustomMethod
print = either show unCustomMethod