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 GHC.Prim | |
import GHC.TypeLits | |
import SuperRecord | |
type BuildRecA c lts = | |
( BuildRecA' c lts | |
, KnownNat (RecSize lts) | |
) | |
buildRecA |
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 BlockArguments #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE DerivingStrategies #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE MagicHash #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE OverloadedLabels #-} |
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 FlexibleInstances #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
module NEL where | |
import Data.List.NonEmpty (NonEmpty((:|))) | |
import qualified Data.List.NonEmpty as NonEmpty | |
nel :: (NEL a r) => a -> r | |
nel a = nelgo (a :|) | |
{-# INLINE nel #-} |
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 BlockArguments #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE MagicHash #-} | |
{-# LANGUAGE OverloadedLabels #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE UndecidableInstances #-} |
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
profile() { | |
local size=10 | |
local scale=3 | |
local unit | |
while true; do | |
case "$1" in | |
-n|--size) size=$2; shift; shift;; | |
-p|--scale) scale=$2; shift; shift;; | |
-u|--unit) unit=$2; shift; shift;; | |
--) shift; break;; |
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
#!/usr/bin/env stack | |
{- stack | |
--resolver lts-15.6 | |
--install-ghc runghc | |
-} | |
-- | Demonstrates the 'showName' function. | |
-- | |
-- @TemplateHaskellQuotes@ is enabled so we can use the @'name@ syntax. | |
-- @DuplicateRecordFields@ is enabled to show that we handle name mangling. |
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
#!/usr/bin/env python3 | |
import enum | |
def match(v, allow_partial=False, allow_impossible=False): | |
"""Provides exhaustive pattern matching for Enum.""" | |
if not isinstance(v, enum.Enum): | |
raise ValueError(f'Supplied value is not an Enum: {v}') |
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
-- | Test support for asserting that expressions should not compile. | |
-- | |
-- Attempts to compile the supplied @moduleName@ in @testdata/${moduleName}.hs@ and | |
-- asserts that it both fails to compile and reports error messages that match | |
-- the contents of @testdata/${moduleName}.txt@. | |
-- | |
-- You may be tempted to use @-fdefer-type-errors@ and/or the | |
-- @should-not-typecheck@ package; however, this doesn't work for custom type errors. | |
-- See: https://gitlab.haskell.org/ghc/ghc/-/issues/18310 |
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
#!/usr/bin/env stack | |
{- stack | |
--resolver lts-16.8 | |
--install-ghc runghc | |
-} | |
{-# LANGUAGE DeriveAnyClass #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE DerivingStrategies #-} | |
{-# LANGUAGE LambdaCase #-} |
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
#!/usr/bin/env stack | |
{- stack | |
--resolver lts-16.8 | |
--install-ghc runghc | |
-} | |
{-# OPTIONS_GHC -Wall #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE DataKinds #-} |