Drop 'All' data constructor from 'Lang'
Historically we weren't very disciplined in how we passed around a Lang
on which perform corpus search.
Not only that, but our Lang
type had (before this MR) an All
data constructor which morally didn't belong
to the Lang
type, which is clearly a bounded enumeration of all the languages that we support for corpus
search and stemming. Furthermore, these days the frontend is always going to send us a valid Lang
to begin
with, i.e. if the ExternalAPIs
provider doesn't support searching for a language or the user didn't pick a
language to filter the corpus to begin with, the frontend will default to EN
. If we really don't care about
the language the provider should search for, we can always just use Maybe Lang
in the relevant API function for
the given provider.
Removing the All
data constructor from the Lang
datatype has
several benifits, the main one being that we now have total functions
for things like toISO693
.
This will make possible to write an uniform interface for stemming
stem :: Lang -> StemmingAlgorithm -> T.Text -> T.Text
, as now
Lang
will always map to a valid (ISO693) language.
While this could technically be merged, it's a stepping stone for #324 (closed).