直觀地說,我已經試過 $ ghc -e "import System.Environment" -e "getArgs" -- a b c
ghc: unrecognised flag: --
did you mean one of:
-n
-F
-v
Usage: For basic information, try the `--help' option.
我試圖確保GHC專門遞歸函數,以便所有的東西都被拆箱。完整的示例代碼(以及GHC核心轉儲)可在this gist中找到。有問題的功能如下: import Data.Bits
import qualified Data.Vector.Unboxed as UV
lookupSorted :: Ord a => (Int -> a) -> Int -> a -> Maybe I
在下面的代碼類型推斷,我試圖以匹配GADT構造Cons,讓編譯器看到xs非空: {-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
我有以下Haskell代碼,其編碼在JSON並將它打印數據類型User到標準輸出的列表: {-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.Aeson
import Data.Text
import qualified Data.ByteString.Lazy.Char8 as B
data User