A guide to setting up the Haskell tooling for Emacs in a Nix environment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
• Couldn't match type ‘a’ with ‘a1’ | |
‘a’ is a rigid type variable bound by | |
the type signature for: | |
mogel :: forall a. Show a => a -> (String, a) | |
at src/Types.hs:105:1-48 | |
‘a1’ is a rigid type variable bound by | |
the type signature for: | |
b :: forall a1. Show a1 => Maybe a1 | |
at src/Types.hs:108:5-39 | |
Expected type: Maybe a1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn | |
:: ( Monad m | |
, MonadReader r m | |
, HasX r m | |
, HasY r m | |
, HasZ r m | |
) | |
=> m Bool | |
fn = do | |
r <- ask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Running Emacs Haskell Tooling in a Nix environment | |
A guide to setting up the Haskell tooling for Emacs in a Nix environment. | |
## Configuration | |
### Requirements | |
You will need the following packages: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
someFn :: b -> m a -> m a | |
someStack :: ActionT e m a | |
someStack = do | |
r <- ask | |
info = r ^. getInfo | |
lift $ someFn info _ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ConstraintsOnFunction (mkLookup) where | |
type Lookup m = Request -> m Response | |
mkLookup :: ( | |
AsSomeError e, | |
MonadCatch m, | |
MonadError e m, | |
MonadIO m, | |
MonadResource m) => Lookup m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HasLoggingRep a where | |
toLogEntry :: a -> Text | |
-- ... | |
where | |
logInfo :: forall a . HasLoggingRep a => a -> IO () | |
logInfo = loggerF logger Info . toLogEntry | |
-- ... | |
someFn response = do | |
logInfo response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE InstanceSigs #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
module DynamicReader where | |
import Control.Monad.Reader (MonadReader(ask, local), ask, ReaderT(ReaderT), runReaderT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drv = | |
pkgs.haskell.lib.addBuildDepends | |
(pkgs.haskellPackages.callPackage ./default.nix {}) | |
(with pkgs; [ docker ]) | |
; |