Skip to content

Instantly share code, notes, and snippets.

View adinapoli's full-sized avatar
🐘

Alfredo Di Napoli adinapoli

🐘
View GitHub Profile
{-# LANGUAGE TypeApplications #-}
module Main where
import Prelude
import Text.Read
import Control.Exception (try, evaluate, SomeException)
read' :: Read a => String -> a
read' = Prelude.read
--- a/lib/cgraph/scan.l
+++ b/lib/cgraph/scan.l
@@ -32,7 +32,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
-// #define YY_BUF_SIZE 128000
+#define YY_BUF_SIZE 128000
#define GRAPH_EOF_TOKEN '@' /* lex class must be defined below */
/* this is a workaround for linux flex */
diff --git a/compiler/GHC/Linker/Loader.hs b/compiler/GHC/Linker/Loader.hs
index 2456844e91..33dd3def33 100644
--- a/compiler/GHC/Linker/Loader.hs
+++ b/compiler/GHC/Linker/Loader.hs
@@ -1611,7 +1611,6 @@ locateLib interp hsc_env is_hs lib_dirs gcc_dirs lib0
| otherwise = [ "lib" ++ lib ++ lib_tag <.> "a"
, lib <.> "a" -- native code has no lib_tag
, "lib" ++ lib
- , lib
]
@adinapoli
adinapoli / LiquidWarnings.hs
Created June 1, 2020 13:17
Liquid Warnings
typecheckHook :: [CommandLineOption] -> ModSummary -> TcGblEnv -> TcM TcGblEnv
typecheckHook _ modSum tcGblEnv = do
let fakeSpan = Ghc.RealSrcSpan $
Ghc.realSrcLocSpan (Ghc.mkRealSrcLoc (Ghc.mkFastString (moduleNameString $ moduleName . ms_mod $ modSum)) 10 20)
addWarnAt NoReason fakeSpan (O.text "This is a test!")
-- addErrAt fakeSpan (O.text "huhu")
pure tcGblEnv
Foo Bar Baz
```data Foo = Bar Baz```
configureDynFlags :: Config -> FilePath -> Ghc DynFlags
configureDynFlags cfg tmp = do
df <- getSessionDynFlags
(df',_,_) <- parseDynamicFlags df $ map noLoc $ ghcOptions cfg
loud <- liftIO isLoud
let df'' = df' { importPaths = nub $ idirs cfg ++ importPaths df'
, libraryPaths = nub $ idirs cfg ++ libraryPaths df'
, includePaths = updateIncludePaths df' (idirs cfg) -- addGlobalInclude (includePaths df') (idirs cfg)
, packageFlags = ExposePackage ""
(PackageArg "ghc-prim")
(
[
((Test.hs:1:1, AnnModule), [Test.hs:6:1-6])
,\n ((Test.hs:1:1, AnnWhere), [Test.hs:6:13-17])
,\n ((Test.hs:13:1-9, AnnDcolon), [Test.hs:13:4-5])
,\n ((Test.hs:13:1-9, AnnSemi), [Test.hs:14:1])
,\n ((Test.hs:14:1-7, AnnEqual), [Test.hs:14:4])
,\n ((Test.hs:14:1-7, AnnFunId), [Test.hs:14:1-2])
,\n ((Test.hs:14:1-7, AnnSemi), [Test.hs:16:1])
,\n ((Test.hs:16:1-13, AnnDcolon), [Test.hs:16:6-7])

Keybase proof

I hereby claim:

  • I am adinapoli on github.
  • I am adinapoli (https://keybase.io/adinapoli) on keybase.
  • I have a public key ASAXsMlL8mkU_EE6aH0dPAyMhuDMfZssFy9B6FvEy-GM8wo

To claim this, I am signing this object:

@adinapoli
adinapoli / live_validation.md
Last active February 5, 2017 18:13
How to do live form validation in Elm?

The context: I'm trying to write a small widget where the user can dynamically add and remove parcels, for a shipment e-commerce website. Example:

screen shot 2017-02-05 at 18 58 11

I would like to present user with live form validation: the idea would be to display a message if, for example, the user inserted a non-int value (those fields translate as: weight, width, length, depth).

Suppose I have the following (simplified) model:

diff --git lisp/term/xterm.el lisp/term/xterm.el
index 19eb37a..6298d88 100644
--- lisp/term/xterm.el
+++ lisp/term/xterm.el
@@ -917,6 +917,15 @@ versions of xterm."
;; are more colors to support, compute them now.
(when (> ncolors 0)
(cond
+ ((= (display-color-cells (selected-frame)) 16777216) ; 24-bit xterm
+ (let ((idx (length xterm-standard-colors)))