From 1ea0638c768ed7d2828b411d41a8d741c5c3111d Mon Sep 17 00:00:00 2001 From: Vitalij Zadneprovskij Date: Mon, 31 Aug 2020 12:47:29 +0200 Subject: [PATCH] Cleaned up fp-examples --- .../applicative_example.rs | 0 .../{ => fp_core_examples}/comonad_example.rs | 0 .../{ => fp_core_examples}/empty_example.rs | 0 .../foldable_example.rs | 0 .../function_composition_example.rs | 0 .../{ => fp_core_examples}/functor_example.rs | 0 .../{ => fp_core_examples}/lens_example.rs | 0 fp-examples/src/fp_core_examples/mod.rs | 11 ++++++ .../{ => fp_core_examples}/monad_example.rs | 0 .../{ => fp_core_examples}/monoid_example.rs | 0 .../semigroup_example.rs | 0 .../{ => fp_core_examples}/setoid_example.rs | 0 .../src/{ => fp_jargon}/adt_example.rs | 0 .../{ => fp_jargon}/anamorphism_example.rs | 0 .../src/{ => fp_jargon}/arity_example.rs | 0 .../{ => fp_jargon}/catamorphism_example.rs | 0 .../src/{ => fp_jargon}/closure_example.rs | 0 .../{ => fp_jargon}/continuation_example.rs | 0 .../src/{ => fp_jargon}/contracts_example.rs | 0 .../src/{ => fp_jargon}/currying_example.rs | 0 .../{ => fp_jargon}/endomorphism_example.rs | 0 .../src/{ => fp_jargon}/hof_example.rs | 0 .../{ => fp_jargon}/homomorphism_example.rs | 0 .../src/{ => fp_jargon}/idempotent_example.rs | 0 .../{ => fp_jargon}/isomorphism_example.rs | 0 .../src/{ => fp_jargon}/lambda_example.rs | 0 fp-examples/src/fp_jargon/mod.rs | 21 ++++++++++++ .../src/{ => fp_jargon}/option_example.rs | 0 .../partial_application_example.rs | 0 .../pointed_functor_example.rs | 0 .../src/{ => fp_jargon}/predicate_example.rs | 0 .../src/{ => fp_jargon}/purity_example.rs | 0 .../referential_transparency_example.rs | 0 .../{ => fp_jargon}/side_effects_example.rs | 0 .../{ => fp_jargon}/type_signature_example.rs | 4 +-- fp-examples/src/{ => fp_jargon}/value.rs | 0 fp-examples/src/main.rs | 34 ++----------------- 37 files changed, 36 insertions(+), 34 deletions(-) rename fp-examples/src/{ => fp_core_examples}/applicative_example.rs (100%) rename fp-examples/src/{ => fp_core_examples}/comonad_example.rs (100%) rename fp-examples/src/{ => fp_core_examples}/empty_example.rs (100%) rename fp-examples/src/{ => fp_core_examples}/foldable_example.rs (100%) rename fp-examples/src/{ => fp_core_examples}/function_composition_example.rs (100%) rename fp-examples/src/{ => fp_core_examples}/functor_example.rs (100%) rename fp-examples/src/{ => fp_core_examples}/lens_example.rs (100%) create mode 100644 fp-examples/src/fp_core_examples/mod.rs rename fp-examples/src/{ => fp_core_examples}/monad_example.rs (100%) rename fp-examples/src/{ => fp_core_examples}/monoid_example.rs (100%) rename fp-examples/src/{ => fp_core_examples}/semigroup_example.rs (100%) rename fp-examples/src/{ => fp_core_examples}/setoid_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/adt_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/anamorphism_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/arity_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/catamorphism_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/closure_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/continuation_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/contracts_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/currying_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/endomorphism_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/hof_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/homomorphism_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/idempotent_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/isomorphism_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/lambda_example.rs (100%) create mode 100644 fp-examples/src/fp_jargon/mod.rs rename fp-examples/src/{ => fp_jargon}/option_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/partial_application_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/pointed_functor_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/predicate_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/purity_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/referential_transparency_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/side_effects_example.rs (100%) rename fp-examples/src/{ => fp_jargon}/type_signature_example.rs (82%) rename fp-examples/src/{ => fp_jargon}/value.rs (100%) diff --git a/fp-examples/src/applicative_example.rs b/fp-examples/src/fp_core_examples/applicative_example.rs similarity index 100% rename from fp-examples/src/applicative_example.rs rename to fp-examples/src/fp_core_examples/applicative_example.rs diff --git a/fp-examples/src/comonad_example.rs b/fp-examples/src/fp_core_examples/comonad_example.rs similarity index 100% rename from fp-examples/src/comonad_example.rs rename to fp-examples/src/fp_core_examples/comonad_example.rs diff --git a/fp-examples/src/empty_example.rs b/fp-examples/src/fp_core_examples/empty_example.rs similarity index 100% rename from fp-examples/src/empty_example.rs rename to fp-examples/src/fp_core_examples/empty_example.rs diff --git a/fp-examples/src/foldable_example.rs b/fp-examples/src/fp_core_examples/foldable_example.rs similarity index 100% rename from fp-examples/src/foldable_example.rs rename to fp-examples/src/fp_core_examples/foldable_example.rs diff --git a/fp-examples/src/function_composition_example.rs b/fp-examples/src/fp_core_examples/function_composition_example.rs similarity index 100% rename from fp-examples/src/function_composition_example.rs rename to fp-examples/src/fp_core_examples/function_composition_example.rs diff --git a/fp-examples/src/functor_example.rs b/fp-examples/src/fp_core_examples/functor_example.rs similarity index 100% rename from fp-examples/src/functor_example.rs rename to fp-examples/src/fp_core_examples/functor_example.rs diff --git a/fp-examples/src/lens_example.rs b/fp-examples/src/fp_core_examples/lens_example.rs similarity index 100% rename from fp-examples/src/lens_example.rs rename to fp-examples/src/fp_core_examples/lens_example.rs diff --git a/fp-examples/src/fp_core_examples/mod.rs b/fp-examples/src/fp_core_examples/mod.rs new file mode 100644 index 0000000..67627a0 --- /dev/null +++ b/fp-examples/src/fp_core_examples/mod.rs @@ -0,0 +1,11 @@ +mod applicative_example; +mod comonad_example; +mod empty_example; +mod foldable_example; +mod function_composition_example; +mod functor_example; +mod lens_example; +mod monad_example; +mod monoid_example; +mod semigroup_example; +mod setoid_example; diff --git a/fp-examples/src/monad_example.rs b/fp-examples/src/fp_core_examples/monad_example.rs similarity index 100% rename from fp-examples/src/monad_example.rs rename to fp-examples/src/fp_core_examples/monad_example.rs diff --git a/fp-examples/src/monoid_example.rs b/fp-examples/src/fp_core_examples/monoid_example.rs similarity index 100% rename from fp-examples/src/monoid_example.rs rename to fp-examples/src/fp_core_examples/monoid_example.rs diff --git a/fp-examples/src/semigroup_example.rs b/fp-examples/src/fp_core_examples/semigroup_example.rs similarity index 100% rename from fp-examples/src/semigroup_example.rs rename to fp-examples/src/fp_core_examples/semigroup_example.rs diff --git a/fp-examples/src/setoid_example.rs b/fp-examples/src/fp_core_examples/setoid_example.rs similarity index 100% rename from fp-examples/src/setoid_example.rs rename to fp-examples/src/fp_core_examples/setoid_example.rs diff --git a/fp-examples/src/adt_example.rs b/fp-examples/src/fp_jargon/adt_example.rs similarity index 100% rename from fp-examples/src/adt_example.rs rename to fp-examples/src/fp_jargon/adt_example.rs diff --git a/fp-examples/src/anamorphism_example.rs b/fp-examples/src/fp_jargon/anamorphism_example.rs similarity index 100% rename from fp-examples/src/anamorphism_example.rs rename to fp-examples/src/fp_jargon/anamorphism_example.rs diff --git a/fp-examples/src/arity_example.rs b/fp-examples/src/fp_jargon/arity_example.rs similarity index 100% rename from fp-examples/src/arity_example.rs rename to fp-examples/src/fp_jargon/arity_example.rs diff --git a/fp-examples/src/catamorphism_example.rs b/fp-examples/src/fp_jargon/catamorphism_example.rs similarity index 100% rename from fp-examples/src/catamorphism_example.rs rename to fp-examples/src/fp_jargon/catamorphism_example.rs diff --git a/fp-examples/src/closure_example.rs b/fp-examples/src/fp_jargon/closure_example.rs similarity index 100% rename from fp-examples/src/closure_example.rs rename to fp-examples/src/fp_jargon/closure_example.rs diff --git a/fp-examples/src/continuation_example.rs b/fp-examples/src/fp_jargon/continuation_example.rs similarity index 100% rename from fp-examples/src/continuation_example.rs rename to fp-examples/src/fp_jargon/continuation_example.rs diff --git a/fp-examples/src/contracts_example.rs b/fp-examples/src/fp_jargon/contracts_example.rs similarity index 100% rename from fp-examples/src/contracts_example.rs rename to fp-examples/src/fp_jargon/contracts_example.rs diff --git a/fp-examples/src/currying_example.rs b/fp-examples/src/fp_jargon/currying_example.rs similarity index 100% rename from fp-examples/src/currying_example.rs rename to fp-examples/src/fp_jargon/currying_example.rs diff --git a/fp-examples/src/endomorphism_example.rs b/fp-examples/src/fp_jargon/endomorphism_example.rs similarity index 100% rename from fp-examples/src/endomorphism_example.rs rename to fp-examples/src/fp_jargon/endomorphism_example.rs diff --git a/fp-examples/src/hof_example.rs b/fp-examples/src/fp_jargon/hof_example.rs similarity index 100% rename from fp-examples/src/hof_example.rs rename to fp-examples/src/fp_jargon/hof_example.rs diff --git a/fp-examples/src/homomorphism_example.rs b/fp-examples/src/fp_jargon/homomorphism_example.rs similarity index 100% rename from fp-examples/src/homomorphism_example.rs rename to fp-examples/src/fp_jargon/homomorphism_example.rs diff --git a/fp-examples/src/idempotent_example.rs b/fp-examples/src/fp_jargon/idempotent_example.rs similarity index 100% rename from fp-examples/src/idempotent_example.rs rename to fp-examples/src/fp_jargon/idempotent_example.rs diff --git a/fp-examples/src/isomorphism_example.rs b/fp-examples/src/fp_jargon/isomorphism_example.rs similarity index 100% rename from fp-examples/src/isomorphism_example.rs rename to fp-examples/src/fp_jargon/isomorphism_example.rs diff --git a/fp-examples/src/lambda_example.rs b/fp-examples/src/fp_jargon/lambda_example.rs similarity index 100% rename from fp-examples/src/lambda_example.rs rename to fp-examples/src/fp_jargon/lambda_example.rs diff --git a/fp-examples/src/fp_jargon/mod.rs b/fp-examples/src/fp_jargon/mod.rs new file mode 100644 index 0000000..c6b6e29 --- /dev/null +++ b/fp-examples/src/fp_jargon/mod.rs @@ -0,0 +1,21 @@ +pub mod adt_example; +mod arity_example; +mod anamorphism_example; +mod catamorphism_example; +mod closure_example; +mod continuation_example; +mod contracts_example; +mod currying_example; +mod endomorphism_example; +mod hof_example; +mod idempotent_example; +mod isomorphism_example; +mod lambda_example; +mod option_example; +mod partial_application_example; +mod pointed_functor_example; +mod predicate_example; +mod purity_example; +mod referential_transparency_example; +mod side_effects_example; +mod type_signature_example; diff --git a/fp-examples/src/option_example.rs b/fp-examples/src/fp_jargon/option_example.rs similarity index 100% rename from fp-examples/src/option_example.rs rename to fp-examples/src/fp_jargon/option_example.rs diff --git a/fp-examples/src/partial_application_example.rs b/fp-examples/src/fp_jargon/partial_application_example.rs similarity index 100% rename from fp-examples/src/partial_application_example.rs rename to fp-examples/src/fp_jargon/partial_application_example.rs diff --git a/fp-examples/src/pointed_functor_example.rs b/fp-examples/src/fp_jargon/pointed_functor_example.rs similarity index 100% rename from fp-examples/src/pointed_functor_example.rs rename to fp-examples/src/fp_jargon/pointed_functor_example.rs diff --git a/fp-examples/src/predicate_example.rs b/fp-examples/src/fp_jargon/predicate_example.rs similarity index 100% rename from fp-examples/src/predicate_example.rs rename to fp-examples/src/fp_jargon/predicate_example.rs diff --git a/fp-examples/src/purity_example.rs b/fp-examples/src/fp_jargon/purity_example.rs similarity index 100% rename from fp-examples/src/purity_example.rs rename to fp-examples/src/fp_jargon/purity_example.rs diff --git a/fp-examples/src/referential_transparency_example.rs b/fp-examples/src/fp_jargon/referential_transparency_example.rs similarity index 100% rename from fp-examples/src/referential_transparency_example.rs rename to fp-examples/src/fp_jargon/referential_transparency_example.rs diff --git a/fp-examples/src/side_effects_example.rs b/fp-examples/src/fp_jargon/side_effects_example.rs similarity index 100% rename from fp-examples/src/side_effects_example.rs rename to fp-examples/src/fp_jargon/side_effects_example.rs diff --git a/fp-examples/src/type_signature_example.rs b/fp-examples/src/fp_jargon/type_signature_example.rs similarity index 82% rename from fp-examples/src/type_signature_example.rs rename to fp-examples/src/fp_jargon/type_signature_example.rs index 9d848af..58dca3d 100644 --- a/fp-examples/src/type_signature_example.rs +++ b/fp-examples/src/fp_jargon/type_signature_example.rs @@ -14,7 +14,7 @@ fn type_signature_example() { // call :: (a -> b) -> a -> b #[allow(dead_code)] - fn call(f: &Fn(A) -> B) -> impl Fn(A) -> B + '_ { + fn call(f: &(dyn Fn(A) -> B)) -> impl Fn(A) -> B + '_ { move |x| f(x) } @@ -26,7 +26,7 @@ fn type_signature_example() { // map :: (a -> b) -> [a] -> [b] #[allow(dead_code)] - fn map(f: &Fn(A) -> B) -> impl Fn(A) -> B + '_ { + fn map(f: &(dyn Fn(A) -> B)) -> impl Fn(A) -> B + '_ { move |x| f(x) } } diff --git a/fp-examples/src/value.rs b/fp-examples/src/fp_jargon/value.rs similarity index 100% rename from fp-examples/src/value.rs rename to fp-examples/src/fp_jargon/value.rs diff --git a/fp-examples/src/main.rs b/fp-examples/src/main.rs index 89d18e5..511ab7b 100644 --- a/fp-examples/src/main.rs +++ b/fp-examples/src/main.rs @@ -3,38 +3,8 @@ extern crate partial_application; #[macro_use] extern crate fp_core; -pub mod adt_example; -mod anamorphism_example; -mod applicative_example; -mod arity_example; -mod catamorphism_example; -mod closure_example; -mod comonad_example; -mod continuation_example; -mod contracts_example; -mod currying_example; -mod empty_example; -mod endomorphism_example; -mod foldable_example; -mod function_composition_example; -mod functor_example; -mod hof_example; -mod idempotent_example; -mod isomorphism_example; -mod lambda_example; -mod lens_example; -mod monad_example; -mod monoid_example; -mod option_example; -mod partial_application_example; -mod pointed_functor_example; -mod predicate_example; -mod purity_example; -mod referential_transparency_example; -mod semigroup_example; -mod setoid_example; -mod side_effects_example; -mod type_signature_example; +mod fp_core_examples; +mod fp_jargon; fn main() { println!("Welcome to fp-core!");