Database records and formlets and optionally populated records can be neatly all represented with the same data type when the fields are all indexed.
class Indexed i a where
type Index i (a :: *)
Background: I am moving away from GMail to my own Haskell-based
server (SMTP receiver/sender, web-based email client, spam filtering,
etc.). All email to @chrisdone.com
goes through this server
(mx.chrisdone.com
) as of today, and chrisdone@gmail.com
forwards a
copy of everything to it.
This is a summary/tracking document of my efforts to simply parse email messages in Haskell for the SMTP receiver.
(defun shoe-write-script (script) | |
"Write SCRIPT to the proper place." | |
(let* ((script-dir (shoe-script-dir script)) | |
(script-path (shoe-script-file-path "/" script-dir))) | |
(with-temp-file script-path (insert script)))) | |
(defun shoe-script-file-path (script &optional dir) | |
"Produce the file path for SCRIPT." | |
(concat (or dir (shoe-script-dir script)) | |
"/" |
This gist demonstrates a trick I came up with which is defining
IsString
for Q (TExp a)
, where a
is lift
-able. This allows you
to write $$("...")
and have the string parsed at compile-time.
On GHC 9, you are able to write $$"..."
instead.
This offers a light-weight way to enforce compile-time constraints. It's
basically OverloadedStrings
with static checks. The inferred return type
{- | |
Examples: | |
> reify @Int $ eval $ A (reflect (abs :: Int -> Int)) (I (-9)) | |
9 | |
> reify @Int $ eval $ A (A (reflect ((*) :: Int -> Int -> Int)) (reflect @Int 3)) (reflect @Int 5) | |
15 |
When buying an SSL certificate from Namecheap, you generate a CSR, which generates a private key, save that for later as private.key.
After you've paid for your certificate, you recieve a zip file that looks like this:
$ ls -alh
total 52K
FROM ubuntu:20.04 | |
RUN apt-get update -y | |
RUN apt-get install -y python pip | |
COPY . /home/chris/Work/alphacephei/vosk-server | |
WORKDIR /home/chris/Work/alphacephei/vosk-server | |
RUN pip install -r requirements.txt && pip3 install sounddevice | |
RUN apt-get install -y libportaudio2 |
With the release of hoogle5, we can now hoogle all local packages.
This let us implement stack hoogle
, which is on the master
branch of stack, but is not yet on a stack release. We'd like you to
try it out before we do!
To upgrade to the latest stack from git, use:
-- This module demonstrates boxed vectors. That means they | |
-- contain values which are thunks, aka values of kind *, aka | |
-- values which may contain _|_. You can write any Haskell | |
-- value in here. | |
-- | |
-- Optimizations: | |
-- | |
-- 1) Use unsafeFreeze to avoid copying. See its haddocks. | |
-- 2) Use unsafeRead/unsafeWrite. These are, clearly, unsafe |
import System.Posix.Signals | |
main = do | |
mainId <- RIO.myThreadId | |
_ <- | |
installHandler | |
softwareTermination | |
(CatchOnce | |
(do S8.putStrLn "Received SIGTERM. Killing main thread." | |
killThread mainId)) |