Don't reimplement listToMaybe
This commit is contained in:
parent
587d779815
commit
984d7c216d
@ -12,7 +12,7 @@ module CabalApi (
|
|||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Exception (throwIO)
|
import Control.Exception (throwIO)
|
||||||
import Data.List (intercalate)
|
import Data.List (intercalate)
|
||||||
import Data.Maybe (fromJust, maybeToList)
|
import Data.Maybe (fromJust, maybeToList, listToMaybe)
|
||||||
import Data.Set (fromList, toList)
|
import Data.Set (fromList, toList)
|
||||||
import Distribution.Package (Dependency(Dependency), PackageName(PackageName))
|
import Distribution.Package (Dependency(Dependency), PackageName(PackageName))
|
||||||
import Distribution.PackageDescription
|
import Distribution.PackageDescription
|
||||||
@ -74,9 +74,7 @@ cabalBuildInfo :: GenericPackageDescription -> BuildInfo
|
|||||||
cabalBuildInfo pd = fromJust $ fromLibrary pd <|> fromExecutable pd
|
cabalBuildInfo pd = fromJust $ fromLibrary pd <|> fromExecutable pd
|
||||||
where
|
where
|
||||||
fromLibrary c = libBuildInfo . condTreeData <$> condLibrary c
|
fromLibrary c = libBuildInfo . condTreeData <$> condLibrary c
|
||||||
fromExecutable c = buildInfo . condTreeData . snd <$> toMaybe (condExecutables c)
|
fromExecutable c = buildInfo . condTreeData . snd <$> listToMaybe (condExecutables c)
|
||||||
toMaybe [] = Nothing
|
|
||||||
toMaybe (x:_) = Just x
|
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user