Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #7 from jonsterling/ready/6
Browse files Browse the repository at this point in the history
Update dependencies to latest versions; add Travis integration
  • Loading branch information
jdegoes committed Sep 10, 2015
2 parents 7c75455 + 1696abd commit 80f0ddd
Show file tree
Hide file tree
Showing 72 changed files with 247 additions and 82 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/.*
!/.gitignore
/output/
/node_modules/
/bower_components/
/tmp/
/node_modules/
/node_modules/
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: node_js
sudo: false
node_js:
- 0.12.7
install:
- npm install -g gulp bower
- npm install
- bower install
script:
- npm run build

3 changes: 3 additions & 0 deletions MODULES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Module Base


19 changes: 10 additions & 9 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "purescript-base",
"license": "MIT",
"authors": [
"John A. De Goes <[email protected]> (http://degoes.net)"
"John A. De Goes <[email protected]> (http://degoes.net)",
"Jon Sterling <[email protected]> (http://jonmsterling.com)"
],
"ignore": [
"**/.*",
Expand All @@ -16,19 +17,19 @@
"package.json"
],
"dependencies": {
"purescript-arrays": "^0.4.0",
"purescript-arrays": "^0.4.2",
"purescript-control": "^0.3.0",
"purescript-either": "^0.2.0",
"purescript-enums": "^0.5.0",
"purescript-either": "^0.2.2",
"purescript-enums": "^0.7.0",
"purescript-foldable-traversable": "^0.4.0",
"purescript-lists": "^0.7.0",
"purescript-lists": "^0.7.4",
"purescript-math": "^0.2.0",
"purescript-maybe": "^0.3.0",
"purescript-maybe": "^0.3.4",
"purescript-monoid": "^0.3.0",
"purescript-strings": "^0.5.0",
"purescript-strings": "^0.7.0",
"purescript-tuples": "^0.4.0",
"purescript-console": "^0.1.0",
"purescript-console": "^0.1.1",
"purescript-unfoldable": "^0.4.0",
"purescript-integers": "^0.2.0"
"purescript-integers": "^0.2.1"
}
}
3 changes: 3 additions & 0 deletions docs/Base.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Module Base


File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Module Control.Monad.Eff.Console

Console-related functions and effect type.

#### `CONSOLE`

``` purescript
Expand Down
21 changes: 21 additions & 0 deletions docs/Control/Monad/Eff/Console/Unsafe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Module Control.Monad.Eff.Console.Unsafe

Unsafe functions to display arbitrary values.

#### `logAny`

``` purescript
logAny :: forall a eff. a -> Eff (console :: CONSOLE | eff) Unit
```

Write an arbitrary value to the console.

#### `errorAny`

``` purescript
errorAny :: forall a eff. a -> Eff (console :: CONSOLE | eff) Unit
```

Write an error with an arbitrary value to the console.


File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 14 additions & 1 deletion docs/Data/Array.purs → docs/Data/Array.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,20 @@ Running time: `O(n)` where `n` is the length of the array
uncons :: forall a. Array a -> Maybe { head :: a, tail :: Array a }
```

Break an array into its first element, and the remaining elements
Break an array into its first element and remaining elements.

Using `uncons` provides a way of writing code that would use cons patterns
in Haskell or pre-PureScript 0.7:
``` purescript
f (x : xs) = something
f [] = somethingElse
```
Becomes:
``` purescript
f arr = case uncons arr of
Just { head: x, tail: xs } -> something
Nothing -> somethingElse
```

#### `index`

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions docs/Data/Char.purs → docs/Data/Char.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,20 @@ fromCharCode :: Int -> Char

Constructs a character from the given Unicode numeric value.

#### `toLower`

``` purescript
toLower :: Char -> Char
```

Converts a character to lowercase.

#### `toUpper`

``` purescript
toUpper :: Char -> Char
```

Converts a character to uppercase.


2 changes: 2 additions & 0 deletions docs/Data/Either.purs → docs/Data/Either.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ instance foldableEither :: Foldable (Either a)
instance bifoldableEither :: Bifoldable Either
instance traversableEither :: Traversable (Either a)
instance bitraversableEither :: Bitraversable Either
instance semiringEither :: (Semiring b) => Semiring (Either a b)
instance semigroupEither :: (Semigroup b) => Semigroup (Either a b)
```

#### `either`
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions docs/Data/Int.purs → docs/Data/Int.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,33 @@ Creates an `Int` from a `Number` value. The number must already be an
integer and fall within the valid range of values for the `Int` type
otherwise `Nothing` is returned.

#### `floor`

``` purescript
floor :: Number -> Int
```

Convert a `Number` to an `Int`, by taking the closest integer equal to or
less than the argument. Values outside the `Int` range are clamped.

#### `ceil`

``` purescript
ceil :: Number -> Int
```

Convert a `Number` to an `Int`, by taking the closest integer equal to or
greater than the argument. Values outside the `Int` range are clamped.

#### `round`

``` purescript
round :: Number -> Int
```

Convert a `Number` to an `Int`, by taking the nearest integer to the
argument. Values outside the `Int` range are clamped.

#### `toNumber`

``` purescript
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/Data/List.purs → docs/Data/List.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ Split a list into two parts:
For example,

```purescript
span (\n -> n % 2 == 1) (1 : 3 : 2 : 4 : 5 : Nil) == Tuple (1 : 3 : Nil) (2 : 4 : 5 : Nil)
span (\n -> n % 2 == 1) (1 : 3 : 2 : 4 : 5 : Nil) == { init: (1 : 3 : Nil), rest: (2 : 4 : 5 : Nil) }
```

Running time: `O(n)`
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 33 additions & 1 deletion docs/Data/Maybe.purs → docs/Data/Maybe.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ instance bindMaybe :: Bind Maybe
instance monadMaybe :: Monad Maybe
instance monadPlusMaybe :: MonadPlus Maybe
instance extendMaybe :: Extend Maybe
instance invariantFirst :: Invariant Maybe
instance invariantMaybe :: Invariant Maybe
instance semigroupMaybe :: (Semigroup a) => Semigroup (Maybe a)
instance monoidMaybe :: (Semigroup a) => Monoid (Maybe a)
instance semiringMaybe :: (Semiring a) => Semiring (Maybe a)
Expand Down Expand Up @@ -55,6 +55,22 @@ maybe x f Nothing == x
maybe x f (Just y) == f y
```

#### `maybe'`

``` purescript
maybe' :: forall a b. (Unit -> b) -> (a -> b) -> Maybe a -> b
```

Similar to `maybe` but for use in cases where the default value may be
expensive to compute. As PureScript is not lazy, the standard `maybe` has
to evaluate the default value before returning the result, whereas here
the value is only computed when the `Maybe` is known to be `Nothing`.

``` purescript
maybe' (\_ -> x) f Nothing == x
maybe' (\_ -> x) f (Just y) == f y
```

#### `fromMaybe`

``` purescript
Expand All @@ -70,6 +86,22 @@ fromMaybe x Nothing == x
fromMaybe x (Just y) == y
```

#### `fromMaybe'`

``` purescript
fromMaybe' :: forall a. (Unit -> a) -> Maybe a -> a
```

Similar to `fromMaybe` but for use in cases where the default value may be
expensive to compute. As PureScript is not lazy, the standard `fromMaybe`
has to evaluate the default value before returning the result, whereas here
the value is only computed when the `Maybe` is known to be `Nothing`.

``` purescript
fromMaybe' (\_ -> x) Nothing == x
fromMaybe' (\_ -> x) (Just y) == y
```

#### `isJust`

``` purescript
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions docs/Data/Maybe/Unsafe.purs → docs/Data/Maybe/Unsafe.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ A partial function that extracts the value from the `Just` data
constructor. Passing `Nothing` to `fromJust` will throw an error at
runtime.

#### `unsafeThrow`

``` purescript
unsafeThrow :: forall a. String -> a
```


File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 28 additions & 4 deletions docs/Data/String.purs → docs/Data/String.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,28 @@ dropWhile :: (Char -> Boolean) -> String -> String

Returns the suffix remaining after `takeWhile`.

#### `stripPrefix`

``` purescript
stripPrefix :: String -> String -> Maybe String
```

If the string starts with the given prefix, return the portion of the
string left after removing it, as a Just value. Otherwise, return Nothing.
* `stripPrefix "http:" "http://purescript.org" == Just "//purescript.org"`
* `stripPrefix "http:" "https://purescript.org" == Nothing`

#### `stripSuffix`

``` purescript
stripSuffix :: String -> String -> Maybe String
```

If the string ends with the given suffix, return the portion of the
string left after removing it, as a Just value. Otherwise, return Nothing.
* `stripSuffix ".exe" "psc.exe" == Just "psc"`
* `stripSuffix ".exe" "psc" == Nothing`

#### `fromCharArray`

``` purescript
Expand Down Expand Up @@ -120,7 +142,7 @@ lastIndexOf :: String -> String -> Maybe Int
```

Returns the index of the last occurrence of the first string in the
second string. Returns `-1` if there is no match.
second string. Returns `Nothing` if there is no match.

#### `lastIndexOf'`

Expand Down Expand Up @@ -178,16 +200,18 @@ Returns the string without the first `n` characters.
count :: (Char -> Boolean) -> String -> Int
```

Returns the number of characters in the string for which the predicate holds.
Returns the number of contiguous characters at the beginning
of the string for which the predicate holds.

#### `split`

``` purescript
split :: String -> String -> Array String
```

Returns the substrings of the first string separated along occurences
of the second string.
Returns the substrings of the second string separated along occurences
of the first string.
* `split " " "hello world" == ["hello", "world"]`

#### `toCharArray`

Expand Down
6 changes: 3 additions & 3 deletions docs/Data/String/Regex.purs → docs/Data/String/Regex.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ See the [reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe
#### `search`

``` purescript
search :: Regex -> String -> Int
search :: Regex -> String -> Maybe Int
```

Returns the index of the first match of the `Regex` in the string, or
`-1` if there is no match.
Returns `Just` the index of the first match of the `Regex` in the string,
or `Nothing` if there is no match.

#### `split`

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 13 additions & 4 deletions docs/Prelude.purs → docs/Prelude.md
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ multiplication, division, and modulo (division remainder) operations.
Instances must satisfy the following law in addition to the `Semiring`
laws:

- Remainder: `a / b * b + (a `mod` b) = a`
- Remainder: ``a / b * b + (a `mod` b) = a``

##### Instances
``` purescript
Expand Down Expand Up @@ -756,7 +756,7 @@ comparing two values:

`LT` - The first value is _less than_ the second.
`GT` - The first value is _greater than_ the second.
`EQ` - The first value is _equal to_ or _incomparable to_ the second.
`EQ` - The first value is _equal to_ the second.

##### Instances
``` purescript
Expand All @@ -775,9 +775,10 @@ class (Eq a) <= Ord a where
compare :: a -> a -> Ordering
```

The `Ord` type class represents types which support comparisons.
The `Ord` type class represents types which support comparisons with a
_total order_.

`Ord` instances should satisfy the laws of _partially orderings_:
`Ord` instances should satisfy the laws of total orderings:

- Reflexivity: `a <= a`
- Antisymmetry: if `a <= b` and `b <= a` then `a = b`
Expand Down Expand Up @@ -835,6 +836,12 @@ _left-associative / precedence 4_

Test whether one value is _non-strictly greater than_ another.

#### `unsafeCompare`

``` purescript
unsafeCompare :: forall a. a -> a -> Ordering
```

#### `Bounded`

``` purescript
Expand All @@ -859,6 +866,7 @@ instance boundedBoolean :: Bounded Boolean
instance boundedUnit :: Bounded Unit
instance boundedOrdering :: Bounded Ordering
instance boundedInt :: Bounded Int
instance boundedChar :: Bounded Char
instance boundedFn :: (Bounded b) => Bounded (a -> b)
```

Expand All @@ -880,6 +888,7 @@ instance boundedOrdBoolean :: BoundedOrd Boolean
instance boundedOrdUnit :: BoundedOrd Unit
instance boundedOrdOrdering :: BoundedOrd Ordering
instance boundedOrdInt :: BoundedOrd Int
instance boundedOrdChar :: BoundedOrd Char
```

#### `BooleanAlgebra`
Expand Down
Loading

0 comments on commit 80f0ddd

Please sign in to comment.