- expression-oriented programming one of the great advances of FP
- expressions plug together like legos, making more malleable programming experience in-the-small
Write in an expression-oriented style, scoping variables as locally as possible:
KDIR ?= /lib/modules/$(shell uname -r) | |
SDIR ?= $(KDIR)/source | |
CLANG ?= clang | |
LLC ?= llc | |
#ARCH := $(subst x86_64,x86,$(shell arch)) | |
ARCH := x86 | |
BIN := modify-ping-ttl.o | |
CLANG_FLAGS = -I. -I$(SDIR)/arch/$(ARCH)/include \ | |
-I$(SDIR)/arch/$(ARCH)/include/generated \ |
import Network.Socket | |
import Control.Concurrent | |
import qualified System.IO as IO | |
type HandlerFunc = SockAddr -> String -> IO () | |
serveLog :: String -- ^ Port number or name; 514 is default | |
-> HandlerFunc -- ^ Function to handle incoming messages | |
-> IO () | |
serveLog port handlerfunc = withSocketsDo $ |