File: NestedSymbolsInTypeSpec.hs

package info (click to toggle)
haskell-persistent 2.13.3.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,080 kB
  • sloc: haskell: 12,098; makefile: 3
file content (44 lines) | stat: -rw-r--r-- 1,551 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{-# OPTIONS_GHC -Wno-unused-local-binds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UndecidableInstances #-}

module Database.Persist.TH.NestedSymbolsInTypeSpec where

import Data.Map
import Database.Persist.TH.NestedSymbolsInTypeSpecImports
import TemplateTestImports

mkPersist sqlSettings [persistLowerCase|
PathEntitySimple
    readOnly  (Maybe (SomePath ReadOnly))

PathEntityNested
    paths  (Maybe (Map Text [SomePath ReadWrite]))
|]

spec :: Spec
spec = describe "NestedSymbolsInType" $ do
    it "should support nested parens" $ do
        let mkPathEntitySimple :: Maybe (SomePath ReadOnly) -> PathEntitySimple
            mkPathEntitySimple = PathEntitySimple
            pathEntitySimpleReadOnly' :: PathEntitySimple -> Maybe (SomePath ReadOnly)
            pathEntitySimpleReadOnly' = pathEntitySimpleReadOnly
        compiles

    it "should support deeply nested parens + square brackets" $ do
        let mkPathEntityNested :: Maybe (Map Text [SomePath ReadWrite]) -> PathEntityNested
            mkPathEntityNested = PathEntityNested
            pathEntityNestedPaths' :: PathEntityNested -> Maybe (Map Text [SomePath ReadWrite])
            pathEntityNestedPaths' = pathEntityNestedPaths
        compiles

compiles :: Expectation
compiles = True `shouldBe` True