Skip to content

Commit b0cfd6f

Browse files
committed
README and LICENSE
1 parent 9760ecb commit b0cfd6f

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed

LICENSE

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2014, TypeLift
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
* Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
* Neither the name of the {organization} nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
[![Build Status](https://travis-ci.org/typelift/Swiftx.svg)](https://travis-ci.org/typelift/Swiftx)
2+
3+
Swiftx
4+
======
5+
6+
Swiftx is a Swift library containing functional abstractions and extensions to
7+
the Swift Standard Library. Swiftz Core is a smaller and simpler way to introduce pure functional
8+
datatypes into any codebase.
9+
10+
Setup
11+
-----
12+
13+
Swiftx can be included one of two ways:
14+
15+
**Framework**
16+
17+
- Drag `Swiftx.xcodeproj` or `Swiftx-iOS.xcodeproj` into your project tree as a subproject
18+
- Under your project's Build Phases, expand Target Dependencies
19+
- Click the + and add Swiftx
20+
- Expand the Link Binary With Libraries phase
21+
- Click the + and add Swiftx
22+
- Click the + at the top left corner to add a Copy Files build phase
23+
- Set the directory to `Frameworks`
24+
- Click the + and add Swiftx
25+
26+
**Standalone**
27+
28+
- Copy the swift files under `Swiftx/Swiftx` into your project.
29+
30+
Introduction
31+
------------
32+
33+
Swiftx provides a number of common data types and abstractions any codebase can utilize.
34+
35+
A small example:
36+
37+
```swiftz
38+
import Swiftx
39+
40+
let str : String? = .Some("Hello ")
41+
let greeting = (+"World") <^> str // .Some("Hello World")
42+
```
43+
44+
Seamless interaction with existing platform libraries is also possible with
45+
minimal effort:
46+
47+
```swiftz
48+
import Foundation
49+
import struct Swiftx.Result
50+
51+
/// result now contains either an array of file paths or the error generated by `NSFileManager`.
52+
let result : Result<[String]> = from({ ep in
53+
let documentsDirectory : String = (NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as String)
54+
return (NSFileManager.defaultManager().contentsOfDirectoryAtPath(documentsDirectory, error: ep) as [String]?) ?? []
55+
})
56+
```
57+
58+
59+
Swiftx can even help with expressions of nothingness or errors:
60+
61+
```swiftz
62+
import Swiftx
63+
64+
/// We may not be able to do what we said we'd do, but this definition compiles. At runtime,
65+
/// any code that invokes this function will immediately halt the program.
66+
func provePEqualsNP() -> Proof<P, NP> {
67+
return undefined()
68+
}
69+
```
70+
71+
System Requirements
72+
===================
73+
74+
Swiftz and Swiftz Core support OS X 10.9+ and iOS 7.0+.
75+
76+
License
77+
=======
78+
79+
Swiftx is released under the BSD license.
80+

0 commit comments

Comments
 (0)