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
lookupGlobal :: HscEnv -> Name -> IO TyThing | |
-- This may look up an Id that one one has previously looked up. | |
-- If so, we are going to read its interface file, and add its bindings | |
-- to the ExternalPackageTable. | |
lookupGlobal hsc_env name | |
= do { -- Try local envt | |
let mod = icInteractiveModule (hsc_IC hsc_env) | |
dflags = hsc_dflags hsc_env | |
tcg_semantic_mod = | |
if thisPackage dflags == moduleUnitId mod |
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
% Build main.pdf: | |
% lhs2TeX main.lhs -o main.tex | |
% pdflatex main.tex | |
\documentclass{article} | |
%%%%%%%%%%%%%% Color-related things %%%%%%%%%%%%%% | |
\usepackage[dvipsnames]{xcolor} |
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
import Data.Either (either) | |
import Data.Functor ((<$>)) | |
class Applicative f => Selective f where | |
handle :: f (Either a b) -> f (a -> b) -> f b | |
select :: Selective f => | |
f (Either a b) -> f (a -> c) -> f (b -> c) -> f c | |
select e fa fb = handle (Left <$> e) (either <$> fa <*> fb) |
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 DeriveGeneric, DuplicateRecordFields #-} | |
import Text.HTML.TagSoup | |
import Text.HTML.TagSoup.Match | |
import Data.List.Extra (chunksOf, trim) | |
import Generics.Pointless.Combinators (split) | |
import Data.Aeson (ToJSON, encode) | |
import GHC.Generics (Generic) | |
import Data.List (isInfixOf, isPrefixOf, find) | |
import Data.Char (isSpace) |
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 DerivingVia #-} | |
module Main where | |
import Control.Monad.State | |
import Data.Functor.Identity | |
newtype Counter a = Counter (Int -> (a, Int)) | |
deriving Functor via (State Int) | |
{- |
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
import System.Environment (getArgs) | |
{-# OPTIONS_GHC -funbox-strict-fields #-} | |
data Nat = Zero | Succ !Nat deriving (Show) | |
fromNat :: Nat -> Integer | |
fromNat Zero = 0 | |
fromNat (Succ n) = fromNat n + 1 |
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 #-} | |
import Control.Monad | |
import Control.Monad.ST | |
import Control.Exception | |
import System.Random | |
import Data.Functor | |
import qualified Data.Vector.Generic.Mutable as V | |
import qualified Data.Vector.Unboxed as U |
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 BangPatterns #-} | |
class Mergeable a where | |
mergeAppend :: a -> a -> a | |
mergeAppend _a b = b | |
instance Mergeable Bool | |
instance Mergeable a => Mergeable (Maybe a) where | |
mergeAppend = mayMerge |
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
artem@prl-julia:~/Dev/ghc/ghc-duplicate-packages-t18125-t16318-3$ cat pe-r | |
clear-package-db | |
global-package-db | |
package-db /home/artem/.cabal/store/ghc-8.10.1/package.db | |
package-id base-4.14.0.0 | |
package-id random-1.1-f453c042ea8c8bf59e5bb793c33f7ae4920ff92b828974833161b30ea32713ba | |
artem@prl-julia:~/Dev/ghc/ghc-duplicate-packages-t18125-t16318-3$ cat Main.hs | |
import System.Random | |
main :: IO () |
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 RecordWildCards, FlexibleContexts #-} | |
-- The Computer Language Benchmarks Game | |
-- https://salsa.debian.org/benchmarksgame-team/benchmarksgame/ | |
-- | |
-- Contributed by cahu ette | |
module Main where |