takoeight0821
例えば、"Applicative f => (a -> f b) -> s -> f t"で検索したらlensパッケージのTraversalがヒットして欲しい、みたいな具合です
stack --local-bin-path /path/to/install install hoge ではダメなんですかね。--local-bin-path でインストールされた奴はstack execなしでも動きますね。.stack-work/install以下と混同してたっぽいです。local-bin-pathで指定すれば、オプションで指定しなくてもそうなるはずです。 https://docs.haskellstack.org/en/stable/yaml_configuration/#local-bin-path
data Person = Person {
pName :: !Text
, pAge :: !Natural
} deriving (Eq, Show)
instance Interpret Person where
autoWith _ = autoWith $ defaultInterpretOptions {fieldModifier = T.drop 1}
instance Inject Person where
injectWith _ = injectWith $ defaultInterpretOptions {fieldModifier = T.drop 1}
instance Interpret Person where
autoWith _ = record $
Person <$> field "name" strictText
<*> field "age" natural
InputType Person を自分で定義してあげないといけない予感?RecordLits 直接いじろうとしてもValueの肩が Exp Src X なのでうまく行きそうにないですね自前でレコードの Interpret インスタンス書いたときそれで詰まった気がします。現状レコードは柔軟に型定義できなさそうです
data Person = Person {
pName :: !Text
, pAge :: !Natural
} deriving (Eq, Generic, Show)
-- 一旦Genericを用いてInjectのインスタンス定義
instance Inject Person
-- !?
class MyInject a where
myInject :: InputType a
instance MyInject Person where
myInject = injectWith $ defaultInterpretOptions {fieldModifier = T.drop 1}
> let p = Person "Hiroto" 29
> pretty $ embed myInject p
> "{ Name = "hiroto", Age = 29 }"
autoWith options = fmap (evalState (genericAutoWith options) 1) を貼り付けてoptionの所変えてやってみては?genericAutoWith options が State Int (Type (Rep Person a)) で to が Rep Person a -> Person になるはずなんですけど通りませんかね:set prompt "> " :seti -XOverloadedStrings :seti -XScopedTypeVariables :set -Wall :set -fno-warn-type-defaults :set -DGHCI :set +s :set +t :set -package pretty-simple import Text.Pretty.Simple (pPrint) :set -interactive-print pPrint
\u0000 みたいなのはコードポイントの表現なので、コードポイントとしてのパースに失敗するとパースエラーになるのかなと。\\uあああ みたいなのならいけるんでしょうね。--ghc-options="-Wall -Werror" とすれば良いっぽい?--ghc-options="-Werror -Wall" と結果は変わりません。。。packages: ./gtk2hs-buildtools.cabal package gtk2hs-buildtools ghc-options: -Wall -Werror allow-newer: all