1
1
mirror of https://github.com/github/semantic.git synced 2025-01-07 07:58:12 +03:00
semantic/src/Language.hs

31 lines
531 B
Haskell
Raw Normal View History

2016-02-11 01:30:14 +03:00
module Language where
2016-02-11 01:32:11 +03:00
import Data.Text
2016-02-11 01:30:14 +03:00
-- | A programming language.
data Language =
C
| CoffeeScript
| CPlusPlus
| CSharp
| CSS
| Haskell
| HTML
| Java
2016-02-11 01:30:14 +03:00
| JavaScript
| ObjectiveC
| Perl
| PHP
| Python
| R
| Ruby
| Swift
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
_ -> Nothing