Skip to content

Commit 828468e

Browse files
author
bhgomes
committed
update documentation
1 parent 3e2b1c0 commit 828468e

File tree

8 files changed

+124
-23
lines changed

8 files changed

+124
-23
lines changed

.appveyor.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
environment:
2+
matrix:
3+
- julia_version: 1.0
4+
- julia_version: 1.1
5+
- julia_version: 1.2
6+
- julia_version: 1.3
7+
- julia_version: nightly
8+
9+
platform:
10+
- x86
11+
- x64
12+
13+
matrix:
14+
allow_failures:
15+
- julia_version: nightly
16+
17+
branches:
18+
only:
19+
- master
20+
- /release-.*/
21+
22+
notifications:
23+
- provider: Email
24+
on_build_success: false
25+
on_build_failure: false
26+
on_build_status_changed: false
27+
28+
install:
29+
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))
30+
31+
build_script:
32+
- echo "%JL_BUILD_SCRIPT%"
33+
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"
34+
35+
test_script:
36+
- echo "%JL_TEST_SCRIPT%"
37+
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.travis.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
11
language: julia
2+
23
os:
3-
- linux
44
- osx
5+
- linux
6+
57
julia:
68
- 1.0
79
- 1.1
810
- 1.2
911
- 1.3
12+
- nightly
13+
14+
matrix:
15+
allow_failures:
16+
- julia: nightly
17+
1018
notifications:
1119
email: false
20+
21+
script:
22+
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
23+
- julia --project -e 'using Pkg; Pkg.build(); Pkg.test(; coverage=true)';
24+
25+
after_success:
26+
- julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())';
27+
28+
jobs:
29+
include:
30+
- stage: "Documentation"
31+
julia: 1.0
32+
os: linux
33+
script:
34+
- julia --project=docs/ -e 'using Pkg; Pkg.instantiate();
35+
Pkg.develop(PackageSpec(path=pwd()))'
36+
- julia --project=docs/ docs/make.jl
37+
after_success: skip

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
[![Stable Docs](https://img.shields.io/badge/docs-stable-blue.svg)](https://bhgomes.github.io/SubTypes.jl/stable)
66
[![Latest Docs](https://img.shields.io/badge/docs-latest-blue.svg)](https://bhgomes.github.io/SubTypes.jl/latest)
77
[![Travis Build Status](https://travis-ci.com/bhgomes/SubTypes.jl.svg?branch=master)](https://travis-ci.com/bhgomes/SubTypes.jl)
8+
[![Build status](https://ci.appveyor.com/api/projects/status/9q43kym8re2rw92f?svg=true)](https://ci.appveyor.com/project/bhgomes/subtypes-jl)
9+
[![Formatting](https://img.shields.io/badge/format-tab%204%20margin%2096-888)](https://github.com/domluna/JuliaFormatter.jl)
10+
[![GitHub Repo](https://img.shields.io/badge/repo-GitHub-black)](https://github.com/bhgomes/SubTypes.jl)
811

912
_Custom Subtyping in Julia_
1013

@@ -59,7 +62,7 @@ support(::Constrained{T, S}) = S
5962
To install, run the following in a Julia session:
6063

6164
```julia
62-
]add SubTypes
65+
]add https://github.com/bhgomes/SubTypes.jl
6366
```
6467

6568
---

docs/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[deps]
2+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

docs/make.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# docs/make.jl
2+
# Make Documentation for SubTypes.jl
3+
4+
push!(LOAD_PATH, "../src/")
5+
6+
using Documenter, SubTypes
7+
8+
makedocs(
9+
modules = [SubTypes],
10+
doctest = true,
11+
clean = false,
12+
linkcheck = false,
13+
format = Documenter.HTML(prettyurls=!("local" in ARGS)),
14+
sitename = "SubTypes.jl",
15+
authors = "Brandon H Gomes",
16+
pages = [
17+
"Home" => "index.md",
18+
],
19+
)
20+
21+
deploydocs(
22+
repo = "github.com/bhgomes/SubTypes.jl.git",
23+
target = "build",
24+
deps = nothing,
25+
make = nothing,
26+
)

docs/src/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# SubTypes.jl
2+
3+
_Custom Subtyping in Julia_
4+
5+
[![Travis Build Status](https://travis-ci.com/bhgomes/SubTypes.jl.svg?branch=master)](https://travis-ci.com/bhgomes/SubTypes.jl)
6+
7+
**WIP**
8+
9+
---
10+
##### [(UN)LICENSE](../../UNLICENSE)
11+
Knowledge is Freedom.

src/SubTypes.jl

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,33 @@
11
# src/SubTypes.jl
2-
# Custom subtyping in Julia
2+
# Custom Subtyping in Julia
33

44
__precompile__(true)
55

66
"""```
77
SubTypes
88
```
99
Custom Subtypes in Julia.
10+
See https://github.com/bhgomes/SubTypes.jl for more details.
1011
"""
1112
module SubTypes
1213

1314
import Base: convert, eltype
1415

15-
export SubType,
16-
check_predicate,
17-
predicate,
18-
context,
19-
Constrained,
20-
ConstrainedSymbol,
21-
support
16+
export SubType, check_predicate, predicate, context, Constrained, ConstrainedSymbol, support
2217

2318

2419
"""```
2520
SubType{T, P, Ctx}
2621
```
2722
Subtype structure with underlying type `T`, predicate `P`, and context `Ctx`.
2823
"""
29-
struct SubType{T, P, Ctx}
24+
struct SubType{T,P,Ctx}
3025
value::T
31-
SubType{T}(x::T) where {T} = new{T, Any, nothing}(x)
32-
SubType{T, Any}(x::T) where {T} = new{T, Any, nothing}(x)
33-
function SubType{T, P, Ctx}(x::T) where {T, P, Ctx}
26+
SubType{T}(x::T) where {T} = new{T,Any,nothing}(x)
27+
SubType{T,Any}(x::T) where {T} = new{T,Any,nothing}(x)
28+
function SubType{T,P,Ctx}(x::T) where {T,P,Ctx}
3429
check_predicate(P, Val(Ctx), x)
35-
return new{T, P, Ctx}(x)
30+
return new{T,P,Ctx}(x)
3631
end
3732
end
3833

@@ -42,9 +37,8 @@ check_predicate(P, Val(Ctx), x)
4237
```
4338
Check that `x` satisfies the predicate `P` in context `Ctx`.
4439
"""
45-
function check_predicate(P, ::Val{Ctx}, x)
46-
throw(ArgumentError(
47-
"`$x` does not match the predicate `$P` in context `$Ctx`"))
40+
function check_predicate(P, ::Val{Ctx}, x) where {Ctx}
41+
throw(ArgumentError("`$x` does not match the predicate `$P` in context `$Ctx`"))
4842
end
4943

5044

@@ -77,7 +71,7 @@ predicate(::Type{SubType{T, P}}) === P
7771
```
7872
Return the `predicate` of the `SubType` type.
7973
"""
80-
predicate(::Type{SubType{T, P}}) where {T, P} = P
74+
predicate(::Type{SubType{T,P}}) where {T,P} = P
8175

8276

8377
"""```
@@ -93,7 +87,7 @@ context(::Type{SubType{T, P, Ctx}}) === Ctx
9387
```
9488
Return the `context` of the `SubType` type.
9589
"""
96-
context(::Type{SubType{T, P, Ctx}}) where {T, P, Ctx} = Ctx
90+
context(::Type{SubType{T,P,Ctx}}) where {T,P,Ctx} = Ctx
9791

9892

9993
"""```
@@ -110,15 +104,15 @@ Constrained{T, S} === SubType{T, S, :Constrained}
110104
Constrained types emulate subset inclusion types. That is
111105
`x::Constrained{T,S} <=> x.value::T in S`.
112106
"""
113-
const Constrained{T, S} = SubType{T, S, :Constrained}
107+
const Constrained{T,S} = SubType{T,S,:Constrained}
114108

115109

116110
"""```
117111
ConstrainedSymbol{S} === Constrained{Symbol, S}
118112
```
119113
Constrained symbols are the constrained type of `Symbol`s.
120114
"""
121-
const ConstrainedSymbol{S} = Constrained{Symbol, S}
115+
const ConstrainedSymbol{S} = Constrained{Symbol,S}
122116

123117

124118
"""```
@@ -139,7 +133,7 @@ support(::Type{Constrained{T, S}}) = S
139133
Return the set which defines the predicate, i.e. the support of the
140134
indicator function on `S`.
141135
"""
142-
support(::Type{Constrained{T, S}}) where {T, S} = S
136+
support(::Type{Constrained{T,S}}) where {T,S} = S
143137

144138

145139
"""```

0 commit comments

Comments
 (0)