Debian Codegraph @

src/System/Random/Primitive.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Primitive System.Random simple bindings to Haskell functions
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible #-}
8
9 module System.Random.Primitive where
10
11 open import Agda.Builtin.IO using (IO)
12 open import Agda.Builtin.Char using (Char)
13 open import Agda.Builtin.Float using (Float)
14 open import Agda.Builtin.Int using (Int)
15 open import Agda.Builtin.Nat using (Nat)
16 open import Agda.Builtin.Word using (Word64)
17 open import Foreign.Haskell.Pair using (Pair)
18
19 postulate
20 randomIO-Char : IO Char
21 randomRIO-Char : Pair Char Char → IO Char
22 randomIO-Int : IO Int
23 randomRIO-Int : Pair Int Int → IO Int
24 randomIO-Float : IO Float
25 randomRIO-Float : Pair Float Float → IO Float
26 randomIO-Nat : IO Nat
27 randomRIO-Nat : Pair Nat Nat → IO Nat
28 randomIO-Word64 : IO Word64
29 randomRIO-Word64 : Pair Word64 Word64 → IO Word64
30
31 {-# FOREIGN GHC import System.Random #-}
32
33 {-# COMPILE GHC randomIO-Char = randomIO #-}
34 {-# COMPILE GHC randomRIO-Char = randomRIO #-}
35 {-# COMPILE GHC randomIO-Int = randomIO #-}
36 {-# COMPILE GHC randomRIO-Int = randomRIO #-}
37 {-# COMPILE GHC randomIO-Float = randomIO #-}
38 {-# COMPILE GHC randomRIO-Float = randomRIO #-}
39 {-# COMPILE GHC randomIO-Nat = abs <$> randomIO #-}
40 {-# COMPILE GHC randomRIO-Nat = randomRIO #-}
41 {-# COMPILE GHC randomIO-Word64 = randomIO #-}
42 {-# COMPILE GHC randomRIO-Word64 = randomRIO #-}