2016-02-11 01:30:14 +03:00
|
|
|
module Language where
|
|
|
|
|
2016-05-26 19:58:04 +03:00
|
|
|
import Prologue
|
2016-02-11 01:32:11 +03:00
|
|
|
|
2016-02-11 01:30:14 +03:00
|
|
|
-- | A programming language.
|
|
|
|
data Language =
|
|
|
|
C
|
2016-02-11 01:35:08 +03:00
|
|
|
| CoffeeScript
|
|
|
|
| CPlusPlus
|
|
|
|
| CSharp
|
|
|
|
| CSS
|
|
|
|
| Haskell
|
|
|
|
| HTML
|
|
|
|
| Java
|
2016-02-11 01:30:14 +03:00
|
|
|
| JavaScript
|
2016-02-11 01:35:08 +03:00
|
|
|
| ObjectiveC
|
|
|
|
| Perl
|
|
|
|
| PHP
|
|
|
|
| Python
|
|
|
|
| R
|
|
|
|
| Ruby
|
|
|
|
| Swift
|
2016-05-26 18:34:02 +03:00
|
|
|
deriving (Show)
|
2016-02-11 01:32:11 +03:00
|
|
|
|
|
|
|
-- | Returns a Language based on the file extension (including the ".").
|
|
|
|
languageForType :: Text -> Maybe Language
|
|
|
|
languageForType mediaType = case mediaType of
|
|
|
|
".h" -> Just C
|
|
|
|
".c" -> Just C
|
|
|
|
".js" -> Just JavaScript
|
2016-02-22 06:57:44 +03:00
|
|
|
".rb" -> Just Ruby
|
2016-02-11 01:32:11 +03:00
|
|
|
_ -> Nothing
|