- If you write a server using raw UDP, the size of a packet returned as a result of a packet received must be strictly smaller than the size of the packet received, to prevent DoS amplification attacks.
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 RankNTypes #-} | |
import qualified Data.IntMap as M | |
import Control.Monad.Trans.Free | |
import Control.Monad.Trans | |
{- | |
The phantom parameter s protects labels from escaping an invocation of runGotoT. | |
For example, this program: | |
invalid = runGotoT label >>= runGotoT . goto | |
is rejected at compile time with this version, but crashes |
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 TypeInType, QuantifiedConstraints, ConstraintKinds, RankNTypes, UndecidableInstances, MultiParamTypeClasses, TypeFamilies, KindSignatures #-} | |
module QC where | |
import Data.Constraint | |
import Data.Functor.Contravariant | |
import Data.Kind | |
import Data.Profunctor | |
type C = (Type -> Type) -> (Type -> Type -> Type) -> Constraint |
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 #-} | |
{-# LANGUAGE NoImplicitPrelude #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TypeOperators #-} | |
module Main where | |
import Protolude hiding ((:*:), optional) | |
import Database.Selda |
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
{-| | |
- Example of using free constructions to build a flexible little compiler. | |
- | |
- The goal here is not necessarily efficiency but readability and flexibility. | |
- | |
- The language grammar is represented by an ADT; however, instead of | |
- recursively referring to itself it instead references a type variable. | |
- | |
- We derive instances of 'Functor' and 'Traversable' for this type. | |
- |
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
# use ImageMagick convert | |
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf | |
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf |
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
;; brittany-hs.el --- Minor mode to format JS code on file save | |
;; Version: 0.1.0 | |
;; Copyright (c) 2014 The go-mode Authors. All rights reserved. | |
;; Portions Copyright (c) 2015-present, Facebook, Inc. All rights reserved. | |
;; Redistribution and use in source and binary forms, with or without | |
;; modification, are permitted provided that the following conditions are | |
;; met: |
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 NoImplicitPrelude #-} | |
{-# LANGUAGE MagicHash #-} | |
{-# LANGUAGE UnboxedTuples #-} | |
module Unsafe.Maybe where | |
import GHC.Prim (Addr#,nullAddr#,addrToAny#,anyToAddr#,eqAddr#,unsafeCoerce#) | |
import GHC.Magic (runRW#) | |
import GHC.Types (Any) | |
import Unsafe.Coerce (unsafeCoerce) |
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
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs | |
index 32e581a10d..b320ef42ce 100644 | |
--- a/ghc/GHCi/UI.hs | |
+++ b/ghc/GHCi/UI.hs | |
@@ -76,6 +76,7 @@ import Linker | |
import Maybes ( orElse, expectJust ) | |
import NameSet | |
import Panic hiding ( showException ) | |
+import Type ( expandTypeSynonyms ) | |
import Util |