1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00

so much less code needed!

This commit is contained in:
Patrick Thomson 2018-06-18 11:40:01 -04:00
parent ec1f221660
commit cfbfd0e16e
2 changed files with 0 additions and 14 deletions

View File

@ -93,13 +93,3 @@ extensionsForLanguage language = case language of
-- | Return a language based on a FilePath's extension, or Nothing if extension is not found or not supported. -- | Return a language based on a FilePath's extension, or Nothing if extension is not found or not supported.
languageForFilePath :: FilePath -> Language languageForFilePath :: FilePath -> Language
languageForFilePath = languageForType . takeExtension languageForFilePath = languageForType . takeExtension
-- | Return the filename representing the prelude for the passed language, if any.
-- The convention here is "languagename.ext", lowercase. Note that this path
-- does not include the prelude directory, as that is configurable.
preludeFilename :: Language -> Maybe FilePath
preludeFilename l = case l of
Python -> Just "python.py"
Ruby -> Just "ruby.rb"
JavaScript -> Just "javascript.js"
_ -> Nothing

View File

@ -15,7 +15,6 @@ module Data.Project (
-- * Files -- * Files
, File (..) , File (..)
, file , file
, preludePath
) where ) where
import Prelude hiding (readFile) import Prelude hiding (readFile)
@ -113,6 +112,3 @@ readFile Project{..} f =
| p == "/dev/null" -> pure Nothing | p == "/dev/null" -> pure Nothing
| isJust candidate -> pure candidate | isJust candidate -> pure candidate
| otherwise -> throwError (SomeException (FileNotFound p)) | otherwise -> throwError (SomeException (FileNotFound p))
preludePath :: FilePath -> Language -> Maybe File
preludePath dir lang = fmap (\p -> File (dir </> p) lang) (preludeFilename lang)