monty5811/elm-bible/2.1.0

Bible.Book

The 66 books of the Bible, in order, with their names, sizes and the spellings the parser accepts.

Bible.fromString "Ps 23"
    |> Result.map (Bible.toStartBook >> title)
    == Ok "Psalms"
type alias Book =
Book

A book of the Bible. Get one from all, fromInt or Bible.toStartBook.

Listing books

all : List Book

Every book, from Genesis to Revelation.

fromInt : Int -> Maybe Book

The book with this number, counting Genesis as 1 and Revelation as 66.

Maybe.map name (fromInt 19) == Just "Psalm"


fromInt 67 == Nothing
toInt : Book -> Int

The book's number, from 1 (Genesis) to 66 (Revelation). This is the book part of Bible.encode.

Names

name : Book -> String

The name used in a reference, as Bible.format writes it: "Genesis", "1 Samuel", "Psalm".

title : Book -> String

The name used for the book as a whole, such as in a heading. This is the same as name except for Psalms: name gives "Psalm" (as in "Psalm 23") and title gives "Psalms".

Size

numChapters : Book -> Int

How many chapters the book has.

Maybe.map numChapters (fromInt 19) == Just 150
numVerses : Book -> Int -> Int

How many verses a chapter of the book has, or 0 if the book has no such chapter.

Maybe.map (\psalms -> numVerses psalms 119) (fromInt 19) == Just 176

Parsing

aliases : Book -> List String

The lowercase spellings Bible.fromString accepts for the book. Matching ignores case, a trailing . and extra whitespace.

Maybe.map aliases (fromInt 1) == Just [ "genesis", "gen" ]