Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am fendor on github.
  • I am fendor (https://keybase.io/fendor) on keybase.
  • I have a public key whose fingerprint is A033 78CA E689 ED9C D513 4FBF 48A2 C4D6 A3FF FE8C

To claim this, I am signing this object:

provider :: FormattingProvider
provider uri formatType opts = pluginGetFile "brittanyCmd: " uri $ \file -> do
confFile <- liftIO $ getConfFile file
mtext <- readVFS uri
case mtext of
Nothing -> return $ IdeResultFail (IdeError InternalError "File was not open" Null)
Just text -> case formatType of
FormatRange r -> do
res <- liftIO $ runBrittany tabSize confFile $ extractRange r text
case res of
-- Pretty nasty piecemeal out of json, but I can't see a way to retrieve output of the setupWrapper'd tasks
showTargets :: Verbosity -> ProjectBaseContext -> ProjectBuildContext -> Lock -> IO ()
showTargets verbosity baseCtx buildCtx lock = do
putStr "["
mapM_ doShowInfo targets
putStrLn "]"
where configured = [p | InstallPlan.Configured p <- InstallPlan.toList (elaboratedPlanOriginal buildCtx)]
targets = fst <$> (Map.toList . targetsMap $ buildCtx)
doShowInfo unitId = showInfo verbosity baseCtx buildCtx lock configured unitId
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE LambdaCase #-}
module Haskell.Ide.Engine.TypeMap where
import qualified Data.IntervalMap.FingerTree as IM
everythingButM
:: forall r m
. (Monad m)
=> (r -> r -> r)
-> (forall a . Data a => a -> (m r, Bool))
-> (forall a . Data a => a -> m r)
everythingButM k f x = do
let (v, stop) = f x
if stop
then v
info: Found Stack project at: /home/baldr/Documents/haskell/yesod-test
Using hie version: Version 0.8.0.0 x86_64 ghc-8.4.4
info: Using Stack project at: /home/baldr/Documents/haskell/yesod-test
info: Found StackUsing hoogle db at: /home/baldr/.hoogle/default-haskell-5.0.17.hoo
project at: /home/baldr/Documents/haskell/yesod-test
info: Using Stack project at: /home/baldr/Documents/haskell/yesod-test
DEBUG: reading cache: /home/baldr/Documents/haskell/yesod-test/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/setup-config.ghc-mod.cabal-components
DEBUG: regenerating cache: /home/baldr/Documents/haskell/yesod-test/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/setup-config.ghc-mod.cabal-components (input files changed)
DEBUG: writing memory cache: /home/baldr/Documents/haskell/yesod-test/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/setup-config.ghc-mod.cabal-components
DEBUG: resolveEntrypoint:
update.hs:125:23: error:
• Couldn't match expected type ‘Cabal-2.4.0.1:Distribution.System.Platform’
with actual type ‘Platform’
NB: ‘Platform’
is defined in ‘Distribution.System’ in package ‘Cabal-2.4.1.0’
‘Cabal-2.4.0.1:Distribution.System.Platform’
is defined in ‘Distribution.System’ in package ‘Cabal-2.4.0.1’
• In the ‘argPlatform’ field of a record
In the first argument of ‘stack2nix’, namely
‘Args
-- | Parse command line ghc options and add them to the 'DynFlags' passed
addCmdOpts :: GhcMonad m => LoadGhcEnvironment -> [GHCOption] -> DynFlags -> m DynFlags
addCmdOpts loadGhcEnv cmdOpts df =
if loadGhcEnv == LoadGhcEnvironment
then fst3 <$> G.parseDynamicFlags df (map G.noLoc cmdOpts)
else
--
-- Passes "-hide-all-packages" to the GHC API to prevent parsing of
-- package environment files. However this only works if there is no
-- invocation of `setSessionDynFlags` before calling `initDynFlagsPure`.
-- We have to be more careful about tearing down 'HscEnv's since GHC 8 added an
-- out of process GHCI server which has to be shutdown.
newLightEnv :: IOish m => (DynFlags -> LightGhc DynFlags) -> m HscEnv
newLightEnv mdf = do
df <- liftIO $ do
#if MIN_VERSION_GLASGOW_HASKELL(8,2,0,0)
#else
initStaticOpts
#endif
settings <- initSysTools (Just libdir)
-- | Set the files as targets and load them.
loadTargets :: IOish m => [GHCOption] -> [FilePath] -> Maybe (GHC.Hooks -> GHC.Hooks) -> GmlT m ()
loadTargets opts targetStrs mUpdateHooks = do
crdl <- cradle
let loadGhcEnv = shouldLoadGhcEnvironment crdl
targets' <-
withLightHscEnv loadGhcEnv opts $ \env ->
liftM (nubBy ((==) `on` targetId))
(mapM ((`guessTarget` Nothing) >=> mapFile env) targetStrs)
>>= mapM relativize