What does new Array(x) do? Trick question. It does different things depending on whether x is an integer or something else.
I wanted to replicate this elegant functionality in Haskell: behold.
Just using the shell, either with built-in tools, or 3rd party generators, for building passwords with at least 70-bits of entropy (1 in at least 1,180,591,620,717,411,303,424 possibilities).
Each provide their own advantages and disadvantages.
All possible 94 graphical characters (not the or) are
| {-# LANGUAGE FlexibleInstances #-} | |
| module MiniToneInference where | |
| import Prelude hiding ((&&)) | |
| import Control.Applicative | |
| import Control.Monad | |
| import Data.Map.Strict (Map, (!)) | |
| import Data.Maybe (fromJust) | |
| import Data.Monoid ((<>)) | |
| import Data.Set (isSubsetOf) |
| """ | |
| Stáhni seznam pořadů z webu iVysílání | |
| """ | |
| import json | |
| from urllib.parse import urljoin | |
| import lxml.html | |
| burl = 'http://www.ceskatelevize.cz/ivysilani/podle-abecedy' | |
| ht = lxml.html.parse(burl).getroot() |
| {-# LANGUAGE | |
| TypeFamilies | |
| , KindSignatures | |
| , ScopedTypeVariables | |
| , ConstraintKinds | |
| , FlexibleInstances | |
| , FlexibleContexts | |
| , DeriveGeneric | |
| , DeriveAnyClass | |
| , TypeApplications |
| -- Response to | |
| -- https://gist.github.com/sjoerdvisscher/e8ed8ca8f3b6420b4aebe020b9e8e235 | |
| -- https://twitter.com/sjoerd_visscher/status/975375241932427265 | |
| {-# Language QuantifiedConstraints, TypeOperators, RankNTypes, GADTs, ConstraintKinds, MultiParamTypeClasses, FlexibleInstances, UndecidableInstances, PolyKinds, InstanceSigs #-} | |
| import Data.Coerce | |
| type f ~> g = forall x. f x -> g x |
| {- LANGUAGE UnicodeSyntax -} | |
| import Prelude hiding (sum) | |
| import Control.Monad | |
| import qualified System.Random as R | |
| import qualified Data.Map.Strict as M | |
| -- | |
| -- Define formal power series | |
| -- I'm just using lists of coefficients rather than defining a new type. |
| {-# LANGUAGE GADTs, TypeFamilies, EmptyDataDecls #-} | |
| {- | |
| A Haskell-based implementation of the monadic semantics for the | |
| simply-typed Call-By-Name computational lambda calculus, following | |
| Moggi's 'Computational lambda-calculus and monads' (1989) (technical report version) | |
| but for the typed calculus (rather than untyped as in this paper). | |
| Category theory seminar, Programming Languages and Systems group, |
| import Data.Bits | |
| import Control.Monad | |
| type Z = Integer | |
| -- Find smallest power of two >= given integer. | |
| -- Sadly it's not convenient using the usual interface to Integer | |
| -- Got exceptions when using Data.Bits.Bitwise | |
| suitablePower :: Z -> Int |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE LambdaCase #-} | |
| {-# LANGUAGE PatternGuards #-} | |
| module Unification where | |
| import Control.Monad | |
| import Control.Monad.Gen | |
| import Control.Monad.Trans | |
| import qualified Data.Map.Strict as M | |
| import Data.Foldable | |
| import Data.Monoid |