Применить функцию к каждому элементу списка - это просто:
map _ [] = []
map f (x:xs) = f x : map f xs
#include <assert.h> | |
#include <stdarg.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
enum type { | |
NIL, |
# 0 is too far from ` ;) | |
set -g base-index 1 | |
# Automatically set window title | |
set-window-option -g automatic-rename on | |
set-option -g set-titles on | |
#set -g default-terminal screen-256color | |
set -g status-keys vi | |
set -g history-limit 10000 |
module PktHdrStorableInstance where | |
import Foreign.Marshal.Utils (with) | |
import Foreign.Ptr (plusPtr) | |
import Foreign.Storable | |
import Network.Pcap | |
import Network.Pcap.Base (toPktHdr) | |
#include <pcap.h> |
/* Copyright (c) 2013 Gianni Tedesco | |
* Released under the terms of the GNU GPL version 3 | |
* mmap() packet socket transmission | |
*/ | |
#ifndef __linux__ | |
#error "Are you loco? This is Linux only!" | |
#endif | |
#include <stdio.h> |
#!/usr/bin/env escript | |
-mode(compile). | |
-record(gen, { | |
module, | |
enums = [], | |
structs = [], | |
aliases = [], |
{-# LANGUAGE TypeFamilies, ScopedTypeVariables, ExistentialQuantification, GADTs, Rank2Types #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
module OMSet where | |
import System.Environment (getArgs) | |
import qualified Data.Set as DS | |
-- ocaml modules always used exlpicitly, without inferring from arguments | |
-- simulate it by adding bogus argument to all typeclass types and methods |
#!/usr/bin/env stack | |
-- stack --install-ghc runghc --package turtle --package wreq | |
{-# LANGUAGE OverloadedStrings #-} | |
import qualified Control.Foldl as Fold | |
import Control.Lens ((^.)) | |
import Control.Monad (when) | |
import Data.ByteString.Lazy (hPut) | |
import Data.Maybe (fromMaybe) |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module Main where | |
import Data.Text (Text) | |
import Network.HTTP.Types (status200) | |
import Network.Wai (Application, responseLBS) |
These are instructions for booting from an Ubuntu liveCD and installing NixOS on a machine. I needed to do this because the NixOS liveCD doesn't work on my machine (NixOS/nixpkgs#5829), so I'm just using the Ubuntu installation media as something to boot into.
Much of this is from discussion at NixOS/nixpkgs#14680.
Get the Ubuntu ISO: http://releases.ubuntu.com/16.04.1/ubuntu-16.04.1-desktop-amd64.iso
Write it to a USB drive with unetbootin