forked from lloydmeta/frunk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core 0.0.16 Derives 0.0.17 frunk 0.1.29 Laws 0.0.7 Bump frunk usage of laws
- Loading branch information
Showing
7 changed files
with
58 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "frunk" | ||
version = "0.1.28" | ||
version = "0.1.29" | ||
authors = ["Lloyd <[email protected]>"] | ||
description = "Frunk provides developers with a number of functional programming tools like HList, Coproduct, Generic, LabelledGeneric, Validated, Monoid, Semigroup and friends." | ||
license = "MIT" | ||
|
@@ -16,12 +16,12 @@ time = "0.1.36" | |
|
||
[dependencies.frunk_core] | ||
path = "core" | ||
version = "0.0.15" | ||
version = "0.0.16" | ||
|
||
[dependencies.frunk_derives] | ||
path = "derives" | ||
version = "0.0.16" | ||
version = "0.0.17" | ||
|
||
[dev-dependencies.frunk_laws] | ||
path = "laws" | ||
version = "0.0.6" | ||
version = "0.0.7" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "frunk_core" | ||
version = "0.0.15" | ||
version = "0.0.16" | ||
authors = ["Lloyd <[email protected]>"] | ||
description = "Frunk core provides developers with HList and Generic" | ||
license = "MIT" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "frunk_derives" | ||
version = "0.0.16" | ||
version = "0.0.17" | ||
authors = ["Lloyd <[email protected]>"] | ||
description = "frunk_derives contains the custom derivations for certain traits in Frunk." | ||
license = "MIT" | ||
|
@@ -20,4 +20,4 @@ quote = "0.3.15" | |
|
||
[dependencies.frunk_core] | ||
path = "../core" | ||
version = "0.0.15" | ||
version = "0.0.16" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "frunk_laws" | ||
version = "0.0.6" | ||
version = "0.0.7" | ||
authors = ["Lloyd <[email protected]>"] | ||
description = "frunk_laws contains laws for algebras declared in Frunk." | ||
license = "MIT" | ||
|
@@ -13,7 +13,7 @@ travis-ci = { repository = "lloydmeta/frunk" } | |
|
||
[dependencies.frunk] | ||
path = ".." | ||
version = "0.1.28" | ||
version = "0.1.29" | ||
|
||
[dependencies] | ||
quickcheck = "0.3" | ||
quickcheck = "0.4.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//! Holds declarations for some variatiosn of F | ||
//! | ||
//! One of the goals of this is to allow for both | ||
//! by reference and by value mapping based purely on | ||
//! the kind of argument taken by the function argument | ||
use kind::*; | ||
|
||
pub trait Functor<A, B> | ||
where Self: Kind<A>, | ||
Self: Kind<B> | ||
{ | ||
fn map<F>(self, f: F) -> <Self as Kind<B>>::Repr | ||
where F: FnOnce(A) -> B; | ||
} | ||
|
||
|
||
impl <A, B> Functor<A, B> for Option<A> where Option<A>: Kind<B>{ | ||
|
||
fn map<F>(self, f: F) -> <Self as Kind<B>>::Repr | ||
where F: FnOnce(A) -> B { | ||
match self { | ||
Some(v) => Some(f(v)), | ||
None => None | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub trait Kind {} | ||
|
||
impl <A> Kind for Option<A> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use std::sync::Mutex; | ||
|
||
struct IntHolder(i32); | ||
|
||
fn plus_one(wrapped: &Mutex<IntHolder>) -> Option<i32> { | ||
match wrapped.lock() { | ||
Ok(ref data) => Some(data.0), | ||
_ => None, | ||
}.map(|data| { | ||
data + 1 | ||
}) | ||
} | ||
|
||
fn main() { | ||
let holder_mutx = Mutex::new(IntHolder(420)); | ||
let insides_incremented = plus_one(&holder_mutx); | ||
println!("{:?}", insides_incremented) | ||
} |