Skip to content

Instantly share code, notes, and snippets.

@osa1
Last active December 21, 2015 05:59
Show Gist options
  • Save osa1/6261221 to your computer and use it in GitHub Desktop.
Save osa1/6261221 to your computer and use it in GitHub Desktop.
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
import Control.Monad
import Control.Monad.IO.Class (liftIO)
import Data.Time.LocalTime (ZonedTime (..))
import Database.Persist
import Database.Persist.Sql
import Database.Persist.TH
import Data.Time
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
Site
title String
UniqueTitle title
deriving Show
Entry
title String
update ZonedTime -- UTCTime also fails with same error
content String
siteId SiteId
deriving Show
|]
➜ DB git:(master) ✗ ghc --make DB.hs
[1 of 1] Compiling Main ( DB.hs, DB.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package bytestring-0.10.0.2 ... linking ... done.
Loading package filepath-1.3.0.1 ... linking ... done.
Loading package old-locale-1.0.0.5 ... linking ... done.
Loading package time-1.4.0.1 ... linking ... done.
Loading package unix-2.6.0.1 ... linking ... done.
Loading package directory-1.2.0.1 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package old-time-1.1.0.1 ... linking ... done.
Loading package text-0.11.3.1 ... linking ... done.
Loading package attoparsec-0.10.4.0 ... linking ... done.
Loading package blaze-builder-0.3.1.1 ... linking ... done.
Loading package dlist-0.5 ... linking ... done.
Loading package hashable-1.2.0.7 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package syb-0.4.0 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package unordered-containers-0.2.3.1 ... linking ... done.
Loading package primitive-0.5.0.1 ... linking ... done.
Loading package vector-0.10.0.1 ... linking ... done.
Loading package aeson-0.6.1.0 ... linking ... done.
Loading package base-unicode-symbols-0.2.2.4 ... linking ... done.
Loading package transformers-base-0.4.1 ... linking ... done.
Loading package monad-control-0.3.2.1 ... linking ... done.
Loading package lifted-base-0.2.0.5 ... linking ... done.
Loading package mmorph-1.0.0 ... linking ... done.
Loading package resourcet-0.4.7.1 ... linking ... done.
Loading package nats-0.1 ... linking ... done.
Loading package semigroups-0.9.1 ... linking ... done.
Loading package void-0.6 ... linking ... done.
Loading package conduit-1.0.5 ... linking ... done.
Loading package date-cache-0.3.0 ... linking ... done.
Loading package unix-time-0.1.8 ... linking ... done.
Loading package fast-logger-0.3.1 ... linking ... done.
Loading package monad-logger-0.3.1.1 ... linking ... done.
Loading package base64-bytestring-1.0.0.1 ... linking ... done.
Loading package blaze-markup-0.5.1.5 ... linking ... done.
Loading package blaze-html-0.6.1.1 ... linking ... done.
Loading package path-pieces-0.1.2 ... linking ... done.
Loading package stm-2.4.2 ... linking ... done.
Loading package resource-pool-0.2.1.1 ... linking ... done.
Loading package pool-conduit-0.1.2 ... linking ... done.
Loading package silently-1.2.4.1 ... linking ... done.
Loading package persistent-1.2.0.1 ... linking ... done.
Loading package persistent-template-1.2.0.1 ... linking ... done.
DB.hs:23:73:
No instance for (persistent-1.2.0.1:Database.Persist.Sql.Class.PersistFieldSql
ZonedTime)
arising from a use of `persistent-1.2.0.1:Database.Persist.Sql.Class.sqlType'
Possible fix:
add an instance declaration for
(persistent-1.2.0.1:Database.Persist.Sql.Class.PersistFieldSql
ZonedTime)
In the fourth argument of `persistent-1.2.0.1:Database.Persist.Types.Base.FieldDef', namely
`persistent-1.2.0.1:Database.Persist.Sql.Class.sqlType
(Nothing :: Maybe ZonedTime)'
In the expression:
persistent-1.2.0.1:Database.Persist.Types.Base.FieldDef
(persistent-1.2.0.1:Database.Persist.Types.Base.HaskellName
(Database.Persist.TH.pack' "update"))
(persistent-1.2.0.1:Database.Persist.Types.Base.DBName
(Database.Persist.TH.pack' "update"))
(persistent-1.2.0.1:Database.Persist.Types.Base.FTTypeCon
Nothing (Database.Persist.TH.pack' "ZonedTime"))
(persistent-1.2.0.1:Database.Persist.Sql.Class.sqlType
(Nothing :: Maybe ZonedTime))
[]
True
Nothing
In the fifth argument of `persistent-1.2.0.1:Database.Persist.Types.Base.EntityDef', namely
`[persistent-1.2.0.1:Database.Persist.Types.Base.FieldDef
(persistent-1.2.0.1:Database.Persist.Types.Base.HaskellName
(Database.Persist.TH.pack' "title"))
(persistent-1.2.0.1:Database.Persist.Types.Base.DBName
(Database.Persist.TH.pack' "title"))
(persistent-1.2.0.1:Database.Persist.Types.Base.FTTypeCon
Nothing (Database.Persist.TH.pack' "String"))
(persistent-1.2.0.1:Database.Persist.Sql.Class.sqlType
(Nothing :: Maybe String))
[]
True
Nothing,
persistent-1.2.0.1:Database.Persist.Types.Base.FieldDef
(persistent-1.2.0.1:Database.Persist.Types.Base.HaskellName
(Database.Persist.TH.pack' "update"))
(persistent-1.2.0.1:Database.Persist.Types.Base.DBName
(Database.Persist.TH.pack' "update"))
(persistent-1.2.0.1:Database.Persist.Types.Base.FTTypeCon
Nothing (Database.Persist.TH.pack' "ZonedTime"))
(persistent-1.2.0.1:Database.Persist.Sql.Class.sqlType
(Nothing :: Maybe ZonedTime))
[]
True
Nothing,
persistent-1.2.0.1:Database.Persist.Types.Base.FieldDef
(persistent-1.2.0.1:Database.Persist.Types.Base.HaskellName
(Database.Persist.TH.pack' "content"))
(persistent-1.2.0.1:Database.Persist.Types.Base.DBName
(Database.Persist.TH.pack' "content"))
(persistent-1.2.0.1:Database.Persist.Types.Base.FTTypeCon
Nothing (Database.Persist.TH.pack' "String"))
(persistent-1.2.0.1:Database.Persist.Sql.Class.sqlType
(Nothing :: Maybe String))
[]
True
Nothing,
persistent-1.2.0.1:Database.Persist.Types.Base.FieldDef
(persistent-1.2.0.1:Database.Persist.Types.Base.HaskellName
(Database.Persist.TH.pack' "siteId"))
(persistent-1.2.0.1:Database.Persist.Types.Base.DBName
(Database.Persist.TH.pack' "site_id"))
(persistent-1.2.0.1:Database.Persist.Types.Base.FTTypeCon
Nothing (Database.Persist.TH.pack' "SiteId"))
persistent-1.2.0.1:Database.Persist.Types.Base.SqlInt64
[]
True
Nothing]'
➜ DB git:(master) ✗
/usr/lib64/ghc-7.6.3/package.conf.d:
Cabal-1.16.0
array-0.4.0.1
base-4.6.0.1
bin-package-db-0.0.0.0
binary-0.5.1.1
bytestring-0.10.0.2
containers-0.5.0.0
deepseq-1.3.0.1
directory-1.2.0.1
filepath-1.3.0.1
(ghc-7.6.3)
ghc-prim-0.3.0.0
glib-0.12.4
(haskell2010-1.1.1.0)
(haskell98-2.0.0.2)
hoopl-3.9.0.0
hpc-0.6.0.0
integer-gmp-0.5.0.0
old-locale-1.0.0.5
old-time-1.1.0.1
pretty-1.1.1.0
process-1.1.0.2
rts-1.0
template-haskell-2.8.0.0
time-1.4.0.1
unix-2.6.0.1
/home/omer/.ghc/x86_64-linux-7.6.3/package.conf.d:
Agda-2.3.2.1
CCA-0.1.4
Cabal-1.16.0.3
Diff-0.2.0
Elm-0.8.0.3
Euterpea-1.0.0
GLFW-0.5.1.0
GLURaw-1.3.0.0
GLUT-2.3.1.0
GLUT-2.4.0.0
GraphSCC-1.0.3
HCodecs-0.2.2
HDBC-2.3.1.2
HStringTemplate-0.6.12
HTTP-4000.2.8
HUnit-1.2.5.2
List-0.5.1
MiniKanrenT-0.0.1
MissingH-1.2.0.0
MonadCatchIO-mtl-0.3.0.5
MonadCatchIO-transformers-0.3.0.0
MonadRandom-0.1.11
ObjectName-1.0.0.0
OpenGL-2.6.0.1
OpenGL-2.8.0.0
OpenGLRaw-1.3.0.0
PortMidi-0.1.3
QuickCheck-1.2.0.1
QuickCheck-2.5.1.1
QuickCheck-2.6
ReadArgs-1.2.1
RepLib-0.5.3.1
SDL-0.6.5
SHA-1.6.1
Shen-hs-0.1.0.0
StateVar-1.0.0.0
Tensor-1.0.0.1
abstract-deque-0.2.2
abstract-par-0.3.1
accelerate-0.13.0.5
accelerate-io-0.13.0.2
aeson-0.6.1.0
ansi-terminal-0.6
ansi-wl-pprint-0.6.6
asn1-data-0.7.1
asn1-types-0.1.3
async-2.0.1.4
attempt-0.4.0
attoparsec-0.10.4.0
attoparsec-conduit-1.0.1
attoparsec-enumerator-0.3.1
authenticate-1.3.2.6
base-unicode-symbols-0.2.2.4
base16-bytestring-0.1.1.5
base64-bytestring-1.0.0.1
base64-conduit-1.0.0
basic-prelude-0.3.5.0
bifunctors-3.2.0.1
bimap-0.2.4
binary-0.6.4.0
binary-0.7.1.0
binary-shared-0.8.3
blaze-builder-0.3.1.1
blaze-builder-conduit-1.0.0
blaze-builder-enumerator-0.2.0.5
blaze-html-0.6.1.1
blaze-markup-0.5.1.5
blaze-textual-0.2.0.8
bmp-1.2.4.1
bmp-1.2.5.1
byteorder-1.0.4
bytestring-mmap-0.2.2
cabal-meta-0.4.1.2
cairo-0.12.4
case-insensitive-1.0.0.2
cautious-file-1.0.2
cereal-0.3.5.2
certificate-1.3.7
charset-0.3.4
cipher-aes-0.1.8
cipher-rc4-0.1.2
citeproc-hs-0.3.8
classy-prelude-0.5.7
clientsession-0.9
cmdargs-0.10.3
comonad-3.0.2
comonad-transformers-3.0.1
comonads-fd-3.0.1
concatenative-1.0.1
concrete-typerep-0.1.0.2
conduit-1.0.5
configurator-0.2.0.2
contravariant-0.4
convertible-1.0.11.1
cookie-0.4.0.1
cpphs-1.16
cprng-aes-0.3.4
crypto-api-0.12.1
crypto-api-0.12.2.1
crypto-conduit-0.5.2
crypto-numbers-0.1.3
crypto-pubkey-0.1.3
crypto-pubkey-types-0.3.2
crypto-random-api-0.2.0
cryptohash-0.8.4
cryptohash-0.9.0
css-text-0.1.1
data-accessor-0.2.2.3
data-accessor-mtl-0.2.0.3
data-accessor-template-0.2.1.10
data-default-0.5.3
data-default-class-0.0.1
data-default-instances-base-0.0.1
data-default-instances-containers-0.0.1
data-default-instances-dlist-0.0.1
data-default-instances-old-locale-0.0.1
data-pprint-0.2.1.4
date-cache-0.3.0
derive-2.5.11
digest-0.0.1.2
directory-tree-0.11.0
distributed-process-0.4.2
distributed-process-simplelocalnet-0.2.0.9
distributed-static-0.2.1.1
distributive-0.3.1
dlist-0.5
dyre-0.8.11
either-3.4.1
elerea-2.7.0.2
email-validate-1.0.0
entropy-0.2.1
enumerator-0.4.19
errors-1.4.2
esqueleto-1.2.4
exceptions-0.1.0.1
exceptions-0.1.1
executable-path-0.0.3
extensible-exceptions-0.1.1.4
failure-0.2.0.1
fast-logger-0.3.1
fay-0.14.5.0
fay-0.15.0.0
(fay-base-0.14.3.2)
fclabels-1.1.6
feed-0.3.9.1
file-embed-0.0.4.7
filesystem-conduit-1.0.0
fingertree-0.0.1.1
forml-0.2
free-3.4.2
fsnotify-0.0.11
generic-deriving-1.5.0
geniplate-0.6.0.3
ghc-events-0.4.2.0
ghc-mtl-1.0.1.2
ghc-paths-0.1.0.9
gio-0.12.4
gloss-1.7.8.2
gloss-1.7.8.3
groupoids-3.0.1.1
gtk-0.12.4
haddock-2.13.2
{hakyll-4.2.2.0}
hamlet-1.1.7.1
happstack-server-7.1.7
hashable-1.2.0.7
hashtables-1.0.1.8
hashtables-1.1.0.2
haskeline-0.7.0.3
haskell-lexer-1.0
haskell-src-1.0.1.5
haskell-src-exts-1.13.5
haskell-src-meta-0.6.0.2
haskelldb-2.2.2
heap-0.6.0
heist-0.12.0
helm-0.3.1
helm-0.4
helm-0.5.0
hexpat-0.20.3
highlighting-kate-0.5.3.9
hinotify-0.3.5
hint-0.3.3.6
hjsmin-0.1.4.1
hlint-1.8.44
hlint-1.8.47
hoogle-4.2.16
hostname-1.0
hs-bibutils-4.17
hscolour-1.20.3
hsemail-1.7.6
hslogger-1.2.1
hslua-0.3.6
hspec-1.5.4
hspec-expectations-0.3.2
html-1.0.1.2
html-conduit-1.1.0
http-conduit-1.9.3
http-date-0.0.4
http-reverse-proxy-0.1.1.6
http-types-0.8.0
indents-0.3.3
interpolatedstring-perl6-0.9.0
io-storage-0.3
io-streams-1.1.0.0
jmacro-0.6.7
json-0.5
json-0.7
language-ecmascript-0.12
language-haskell-extract-0.2.4
language-java-0.2.4
language-javascript-0.5.7
language-lua-0.2.0
lens-3.9.0.2
libffi-0.1
lifted-base-0.2.0.5
llvm-3.2.0.2
llvm-base-3.2.0.2
llvm-general-3.4.0.0
logict-0.6
lrucache-1.1.1.3
mainland-pretty-0.2.6
markov-chain-0.0.3.2
mime-mail-0.4.1.2
mime-types-0.1.0.3
mmorph-1.0.0
monad-control-0.3.2.1
monad-logger-0.3.1.1
monad-par-0.3.4.3
monad-par-extras-0.3.3
monadIO-0.10.1.3
mtl-2.1.2
mtlparse-0.1.2
multiset-0.2.2
mwc-random-0.12.0.1
mysql-0.1.1.4
mysql-simple-0.2.2.4
nats-0.1
network-2.4.1.2
network-conduit-1.0.0
network-multicast-0.0.7
network-transport-0.3.0.1
network-transport-tcp-0.3.1
normaldistribution-1.1.0.3
optparse-applicative-0.5.2.1
pandoc-1.11.1
pandoc-types-1.10
pango-0.12.4
parallel-3.2.0.3
parseargs-0.1.3.5
parsec-3.1.3
path-pieces-0.1.2
pcre-light-0.4
pem-0.1.2
persistent-1.2.0.1
persistent-1.2.2.0
persistent-mysql-1.2.1
persistent-sqlite-1.2.0
persistent-template-1.2.0
persistent-template-1.2.0.1
plugins-1.5.3.0
pointedlist-0.4.0.4
pool-conduit-0.1.2
pretty-show-1.5
primitive-0.5.0.1
processing-1.0.0.1
profunctor-extras-3.3
profunctors-3.3.0.1
project-template-0.1.3
publicsuffixlist-0.1
pure-fft-0.2.0
pureMD5-2.1.2.1
pwstore-fast-2.3
quickcheck-io-0.1.0
random-1.0.1.1
rank1dynamic-0.1.0.2
readline-1.0.3.0
reflection-1.3.1
regex-base-0.93.2
regex-compat-0.95.1
regex-pcre-builtin-0.94.4.5.8.31
regex-posix-0.95.2
regex-tdfa-1.1.8
regexpr-0.5.4
repa-3.2.3.3
resource-pool-0.2.1.1
resourcet-0.4.7.1
safe-0.3.3
scotty-0.4.6
semigroupoid-extras-3.0.1
semigroupoids-3.0.2
semigroups-0.9.1
sendfile-0.7.9
setenv-0.1.0
shakespeare-1.0.5
shakespeare-css-1.0.5.1
shakespeare-i18n-1.0.0.2
shakespeare-js-1.1.4
shakespeare-text-1.0.0.5
shelly-1.3.0.7
silently-1.2.4.1
simple-reflect-0.3.1
simple-sendfile-0.2.11
skein-1.0.3
snap-0.12.1
snap-core-0.9.3.1
snap-loader-static-0.9.0.1
snap-server-0.9.3.3
socks-0.5.1
split-0.2.2
srcloc-0.4.0
stm-2.4.2
strict-0.3.2
string-qq-0.0.2
stringsearch-0.3.6.4
stylish-haskell-0.5.6.1
sundown-0.5.0.1
syb-0.3.7
syb-0.4.0
syb-with-class-0.6.1.4
system-fileio-0.3.11
system-filepath-0.4.7
tagged-0.6
tagsoup-0.12.8
tagstream-conduit-0.5.4
tar-0.4.0.1
temporary-1.1.2.4
terminfo-0.3.2.5
test-framework-0.8
test-framework-hunit-0.3.0
test-framework-quickcheck2-0.3.0.1
test-framework-th-0.2.4
texmath-0.6.1.5
text-0.11.3.1
text-binary-0.1.0
th-lift-0.5.5
th-orphans-0.6
threads-0.5.0.2
threepenny-gui-0.1.0.0
time-1.4.1
time-compat-0.1.0.3
tls-1.1.2
tls-extra-0.6.1
transformers-0.3.0.0
transformers-base-0.4.1
transformers-compat-0.1.1.1
type-equality-0.1.2
type-level-0.2.4
unbound-0.4.2
uniplate-1.6.10
unix-compat-0.4.1.1
unix-time-0.1.8
unordered-containers-0.2.3.1
uri-0.1.6.1
url-2.1.3
urlencoded-0.4.0
utf8-light-0.4.0.1
utf8-string-0.3.7
utility-ht-0.0.9
vado-0.0.1
vault-0.2.0.4
vector-0.10.0.1
vector-algorithms-0.5.4.2
vector-binary-instances-0.2.1.0
void-0.6
vty-4.7.3
wai-1.4.0
wai-app-static-1.3.1.2
wai-extra-1.3.4
wai-extra-1.3.4.2
wai-logger-0.3.0
wai-logger-0.3.1
wai-test-1.3.1
warp-1.3.8.1
wl-pprint-text-1.1.0.0
word8-0.0.3
xdg-basedir-0.2.2
xhtml-3000.2.1
xml-1.3.13
xml-conduit-1.1.0.3
xml-types-0.3.3
xmlhtml-0.2.1
xss-sanitize-0.3.3
yaml-0.8.2.4
yesod-1.2.0.1
yesod-auth-1.2.0
{yesod-auth-1.2.0.1}
yesod-core-1.2.0.4
{yesod-core-1.2.1}
yesod-form-1.3.0
yesod-persistent-1.2.0
yesod-platform-1.2.0.1
yesod-routes-1.2.0
yesod-static-1.2.0
yesod-test-1.2.0
zip-archive-0.1.3.4
zlib-0.5.4.1
zlib-bindings-0.1.1.3
zlib-conduit-1.0.0
zlib-enum-0.2.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment