låt @ny = läsbar snapshot av den man vill använda
sudo mv @ @bad; sudo mv @ny @
reboot
sudo systemctl disable NetworkManager.service | |
sudo systemctl disable systemd-networkd |
/* | |
* T T C P . C | |
* | |
* Test TCP connection. Makes a connection on port 5001 | |
* and transfers fabricated buffers or data copied from stdin. | |
* | |
* Usable on 4.2, 4.3, and 4.1a systems by defining one of | |
* BSD42 BSD43 (BSD41a) | |
* Machines using System V with BSD sockets should define SYSV. | |
* |
funkyProduct lst = zipWith | |
(*) | |
(scanl (*) 1 lst) | |
(scanr (*) 1 $ (tail lst)) | |
--Prelude> funkyProduct [2,3,5,10] | |
--[150,100,60,30] |
-- Normal fixed point | |
fix f = f (fix f) | |
-- | Slow comonadic fixed point à la Kenneth Foner: | |
pfix :: Comonad w => w (w a -> a) -> w a | |
pfix = extend wfix | |
-- | Comonadic fixed point à la Kenneth Foner: | |
kfix :: ComonadApply w => w (w a -> a) -> w a | |
kfix w = fix $ \u -> w <@> duplicate u |
{-# LANGUAGE NamedFieldPuns #-} | |
{-# LANGUAGE ViewPatterns #-} | |
import Grammar (BinOp, Identifier, Type, HashMap) | |
import Typed | |
import Control.Comonad | |
import Control.Applicative (liftA2) | |
data Expression t | |
= BinOp {lhs :: Expression t, op :: BinOp, rhs :: Expression t, typ :: t} | |
| MethodCall (Expression t) Identifier [Expression t] t |
class Comonad w => ComonadScan w where | |
scanW :: (a -> w b -> a) -> a -> w b -> w a | |
scanW f acc w = (duplicate w) | |
instance ComonadScan Tree where | |
scanW f acc w@(Node _ as) = let acc' = f acc w in Node acc' (map (scanW f acc') as) |
{-# LANGUAGE ExistentialQuantification #-} | |
import Data.List (unlines) | |
data HasEq = forall a. (Eq a, Show a) => HasEq a | |
data AnyIntegral = forall a. Integral a => Integral a | |
data AnyTree x = forall a b. (Show a, Show b) => Tree x (AnyTree a) (AnyTree b) | Nil | |
instance Show a => Show (AnyTree a) where | |
show (Tree x a b) = show (x,(a,b)) | |
show Nil = "Nil" |
import Data.Monoid | |
import Data.Char (digitToInt) | |
import Data.Foldable (foldrM) | |
--- Part One --- | |
-- Bind using the reader monad: | |
-- x >>= k = \w-> k (x w) w | |
-- head >>= foldrM bar = \w -> foldrM bar (head w) w | |
foo = head >>= foldrM bar |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE ViewPatterns #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
import Prelude hiding (tail, head) |