Commit babfd181 authored by Camil Staps's avatar Camil Staps 🐧

Text.Language: add documentation; add isAlpha check for isConsonant

parent 8866fbcd
Pipeline #8768 passed with stage
in 1 minute and 27 seconds
definition module Text.Language
/**
* A natural language.
*/
:: Language = English
/**
* Check whether a character is a vowel.
*/
isVowel :: Language Char -> Bool
/**
* Check whether a character is a consonant.
*/
isConsonant :: Language Char -> Bool
/**
* Pluralise a noun.
*/
pluralise :: Language String -> String
/**
* Construct a string like "3 items" based on a number and a noun.
*/
pluralisen :: Language Int String -> String
......@@ -2,6 +2,7 @@ implementation module Text.Language
import StdArray
import StdBool
import StdChar
from StdFunc import id
import StdList
import StdString
......@@ -12,7 +13,7 @@ isVowel :: Language Char -> Bool
isVowel English c = isMember c ['aeiou']
isConsonant :: Language Char -> Bool
isConsonant l c = not (isVowel l c)
isConsonant l c = isAlpha c && not (isVowel l c)
pluralise :: Language String -> String
pluralise English s
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment