File: sanity.hs

package info (click to toggle)
haskell-vector-th-unbox 0.2.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 92 kB
  • sloc: haskell: 134; makefile: 3
file content (27 lines) | stat: -rw-r--r-- 702 bytes parent folder | download | duplicates (5)
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
{-# LANGUAGE CPP #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UnicodeSyntax #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}

module Main (main) where

import Prelude
import Data.Default
#if __GLASGOW_HASKELL__ == 704
import qualified Data.Vector.Generic
import qualified Data.Vector.Generic.Mutable
#endif
import Data.Vector.Unboxed.Base (Unbox)
import Data.Vector.Unboxed.Deriving

derivingUnbox "Maybe"
    [t| ∀ a. (Default a, Unbox a) ⇒ Maybe a → (Bool, a) |]
    [| maybe (False, def) (\ x → (True, x)) |]
    [| \ (b, x) → if b then Just x else Nothing |]

main ∷ IO ()
main = return ()