(*      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                 ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                                            ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~              Safe-Inferred Safe-Inferred  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!   ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!   Safe-Inferred Safe-Inferred Safe-Inferred   Safe-Inferred    Safe-InferredNone124F A ReQL value          +     +     p             Safe-InferredA table description+when Nothing, use the connection's databaseA database, referenced by name !  !  !  ! None!"124:<FM")Convert other types into ReQL expressions# A ReQL Term&.An upper or lower bound for between and during*An exclusive bound+An inclusive bound>*A key/value pair used for building objectsBBuild arrays of exprs!A list of termsE,An operation that accepts optional argumentsF+Extend an operation with optional argumentsGState used to build a Term"(A term ready to be sent over the networkM&Internal representation of a ReQL Term] Build a term^Build a term with no optargs`nA shortcut for inserting strings into ReQL expressions Useful when OverloadedStrings makes the type ambiguousa6A shortcut for inserting numbers into ReQL expressionshAn empty objectiAdd a note a a ReQL TermaThis note does not get sent to the server. It is used to annotate backtraces and help debugging."#&'()*+,-./0123456789:;<=>?@ABC!#DEFGHIJKL"$%MNOPQRSTUVWXYZ&'[\()]^*+,-./0_`a1234bcdefg5hi6789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~F"#&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghiH#WX^]MSQNTUVROP9:b3d021"78GHIJKLZ`a>A@?<;=EF[DYc&+*)(',,,g_h456-./i\BCef|"78#WX&+*)(',,,-./02134569:;<=>A@?BC!#DEFGHIJKL"$%M SQNTUVROPYZ&'[\()]^*+,-./0_`a1234bcdefg5hi6789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~A None+F pThe response to a query#A connection to the database serverThe next token to useThe default database.Create a new connection to the database serverExample:4 connect using the default port with no passphrase (note: IPv4 and IPv6 supported)&h <- connect "localhost" 28015 Nothing h <- connect "::1" 28015 NothingSet the default databaseYThe new handle is an alias for the old one. Calling close on either one will close both.Close an open connection Get the next value from a cursor Get the next batch from a cursor/A lazy stream of all the elements in the cursorA strict version of collect2Wait for NoReply queries to complete on the servern() <- runOpts h [NoReply] $ table "users" # get "bob" # update (\row -> merge row ["occupation" := "teacher"]) noReplyWait hMjklmnopqrstuvwxyz{|}~+jklmnopqrstuvwxyz{|}~+|}~psrqjnmlktuvwxyz{o.jnmlkopsrqtuvwxyz{|}~None!"1241Convert the raw query response into useful valuesPer-query settings+Deprecated. Use `ReadMode Outdated` instead"Run a query with the given options%Run a given query and return a Resultrun h $ num 1 :: IO Int13run h $ str "foo" :: IO (Either RethinkDBError Int)WLeft RethinkDB: Unexpected response: "when expecting a Int, encountered String instead"#run h $ str "foo" :: IO (Maybe Int)Nothingrun h $ str "foo" :: IO Inta*** Exception: RethinkDB: Unexpected response: "when expecting a Int, encountered String instead"Qc <- run h $ table "users" # orderBy [asc "name"] # (!"name"):: IO (Cursor Datum)next c Just "bill" collect c["nancy","sabrina"]$Run a given query and return a DatumT; None,The time and date when the query is executed >>> run' h $ nowWBuild a time object from the year, month, day, hour, minute, second and timezone fields%run' h $ time 2011 12 24 23 59 59 "Z"Time<2011-12-24 23:59:59 +0000>DBuild a time object given the number of seconds since the unix epochrun' h $ epochTime 1147162826Time<2006-05-09 08:20:26 +0000>+Build a time object given an iso8601 string+run' h $ iso8601 "2012-01-07T08:34:00-0700"Time<2012-01-07 08:34:00 -0700>%The same time in a different timezone$_ <- run' h $ inTimezone "+0800" now)Test if a time is between two other timesLrun' h $ during (Open $ now R.- (60*60)) (Closed now) $ epochTime 1382919271falseExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time value(Convert a time to another representation(Convert a time to another representationNone$Convert a line object into a polygon6run' h $ fill $ line [[-122,37], [-120,39], [-121,38]]2Polygon<[[-122,37],[-120,39],[-121,38],[-122,37]]>9Convert a GeoJSON object into a RethinkDB geometry object?run' h $ geoJSON ["type" := "Point", "coordinates" := [-45,80]] Point<-45,80>9Convert a RethinkDB geometry object into a GeoJSON object2run' h $ toGeoJSON $ point (-122.423246) 37.7793886{"coordinates":[-122.423246,37.779388],"type":"Point"}2Search a geospatial index for intersecting objectsIrun' h $ table "places" # getIntersecting (point (-122) 37) (Index "geo")[]0Query a geospatial index for the nearest matchesIrun' h $ table "places" # getNearest (point (-122) 37) (Index "location")[]wrun' h $ table "places" # ex getNearest [maxResults 5, maxDist 10, unit Kilometer] (point (-122) 37) (Index "location")[]/Test whether a geometry object includes anotherCrun' h $ circle (point (-122) 37) 5000 # includes (point (-120) 48)false'Test if two geometry objects intersectsMrun' h $ intersects (line [[-122,37],[-120,48]]) (line [[-120,49],[-122,48]])falseCreate a line object"run' h $ line [[-73,45],[-122,37]]Line<[-73,45],[-122,37]>Create a point objectsrun' h $ point (-73) 40 Point<-73,40>Create a polygon object.run' h $ polygon [[-73,45],[-122,37],[-73,40]]/Polygon<[[-73,45],[-122,37],[-73,40],[-73,45]]>Punch a hole in a polygonprun' h $ (polygon [[-73,45],[-122,37],[-73,40]]) # polygonSub (polygon [[-73.2,40.1],[-73.2,40.2],[-73.3,40.1]])ePolygon<[[-73,45],[-122,37],[-73,40],[-73,45]],[[-73.2,40.1],[-73.2,40.2],[-73.3,40.1],[-73.2,40.1]]>'Create a polygon approximating a circleGrun' h $ ex circle [numVertices 6, unit Kilometer] (point (-73) 40) 100Polygon<[[-73,39.099310036015424],[-74.00751390838496,39.54527799206398],[-74.02083610406069,40.445812561599965],[-73,40.900549591978255],[-71.97916389593931,40.445812561599965],[-71.99248609161504,39.54527799206398],[-73,39.099310036015424]]>4Distance between a point and another geometry object 4run' h $ distance (point (-73) 40) (point (-122) 37) P467303546 > run' h $ ex distance [unit Mile] (point (-73) 40) (point (-122) 37) 5460282596796 Optional argument for getNearest Optional argument for getNearest5Optional argument for getNearest, circle and distanceOptional argument for circle None!"24$(Apply a function to a list of arguments.Called do in the official drivers#run h $ (\x -> x R.* 2) `apply` [4]8% Evaluate a JavaScript expressionrun' h $ js "Math.PI"3.141592653589793'let r_sin x = js "Math.sin" `apply` [x]run h $ R.map r_sin [pi, pi/2] [1.2246...,1]Create a table on the server k>>> run' h $ tableCreate (table "posts") def [{"created":1}] >>> run' h $ tableCreate (table "users"){ tablePrimaryKey = Just "name" } def [{"created":1}] >>> run' h $ tableCreate (Table (Just "doctests") "bar" (Just "name")) def [{"created":1}] >>> run' h $ ex tableCreate ["datacenter":="orion"] (Table (Just "doctests") "bar" (Just "name")) def [{"created":1}]5Insert a document or a list of documents into a tablemrun h $ table "users" # insert (map (\x -> ["name":=x]) ["bill", "bob", "nancy" :: Text]) :: IO WriteResponse {inserted:3}mrun h $ table "posts" # insert ["author" := str "bill", "message" := str "hi", "id" := 1] :: IO WriteResponse {inserted:1}run h $ table "posts" # insert ["author" := str "bill", "message" := str "hello", "id" := 2, "flag" := str "deleted"] :: IO WriteResponse {inserted:1}run h $ table "posts" # insert ["author" := str "bob", "message" := str "lorem ipsum", "id" := 3, "flag" := str "pinned"] :: IO WriteResponse {inserted:1}+Add to or modify the contents of a documenturun h $ table "users" # getAll "name" [str "bob"] # update (const ["occupation" := str "tailor"]) :: IO WriteResponse {replaced:1}Replace a document with anotherrun h $ replace (\user -> ["name" := user!"name", "occupation" := str "clothier"]) . R.filter ((R.== str "tailor") . (!?"occupation")) $ table "users" :: IO WriteResponse {replaced:1}Delete the documentsNrun h $ delete . getAll "name" [str "bob"] $ table "users" :: IO WriteResponse {deleted:1}Like map but for write queries>_ <- run' h $ table "users" # replace (without ["post_count"])run h $ forEach (\user -> table "users" # get (user!"name") # ex update [nonAtomic] (const ["post_count" := R.count (table "posts" # R.filter (\post -> post!"author" R.== user!"name"))])) (table "users") :: IO WriteResponse {replaced:2}A table/fmap sort $ run h $ table "users" :: IO [Datum]@[{"post_count":2,"name":"bill"},{"post_count":0,"name":"nancy"}] Drop a table run' h $ tableDrop (table "foo"){"config_changes":[{"new_val":null,"old_val":{"primary_key":"id","write_acks":"majority","durability":"hard","name":"foo","shards":...,"id":...,"db":"doctests"}}],"tables_dropped":1}List the tables in a database<fmap sort $ run h $ tableList (db "doctests") :: IO [String]["places","posts","users"] Addition or concatenation.Use the Num instance, or a qualified operator. run h $ 2 + 57run h $ str "foo" R.+ str "bar""foobar"  Subtraction run h $ 2 - 5-3 Multiplication run h $ 2 * 510 Divisionrun h $ 2 R./ 50.4 Modrun h $ 5 `mod` 21 Boolean orrun h $ True R.|| Falsetrue Boolean andrun h $ True R.&& FalsefalseTest for equality"run h $ ["a" := 1] R.== ["a" := 1]trueTest for inequalityrun h $ 1 R./= Falsetrue Greater thanrun h $ 3 R.> 2true Lesser thanrun h $ (str "a") R.< (str "b")trueGreater than or equal torun h $ [1] R.>= NullfalseLesser than or equal torun h $ 2 R.<= 2trueNegationrun h $ R.not Falsetruerun h $ R.not Nulltrue#The size of a sequence or an array.run h $ count (table "users")2Join two sequences./run h $ [1,2,3] `union` ["a", "b", "c" :: Text][1,2,3,"a","b","c"]Map a function over a sequence-run h $ R.map (!"a") [["a" := 1], ["a" := 2]][1,2]#Filter a sequence given a predicate1run h $ R.filter (R.< 4) [3, 1, 4, 1, 5, 9, 2, 6] [3,1,1,2]KQuery all the documents whose value for the given index is in a given rangeJrun h $ table "users" # between "name" (Closed $ str "a") (Open $ str "c") [{"post_count":2,"name":"bill"}]Append a datum to a sequencerun h $ append 3 [1, 2][1,2,3]3Map a function of a sequence and concat the results*run h $ concatMap id [[1, 2], [3], [4, 5]] [1,2,3,4,5]$SQL-like inner join of two sequencessorted $ run' h $ innerJoin (\user post -> user!"name" R.== post!"author") (table "users") (table "posts") # R.zip # orderBy [asc "id"] # pluck ["name", "message"]B[{"name":"bill","message":"hello"},{"name":"bill","message":"hi"}]$SQL-like outer join of two sequencessorted $ run' h $ outerJoin (\user post -> user!"name" R.== post!"author") (table "users") (table "posts") # R.zip # orderBy [asc "id", asc "name"] # pluck ["name", "message"]S[{"name":"bill","message":"hello"},{"name":"bill","message":"hi"},{"name":"nancy"}] \An efficient inner_join that uses a key for the left table and an index for the right table.sorted $ run' h $ table "posts" # eqJoin "author" (table "users") "name" # R.zip # orderBy [asc "id"] # pluck ["name", "message"]B[{"name":"bill","message":"hello"},{"name":"bill","message":"hi"}]!*Drop elements from the head of a sequence.run h $ skip 2 [1, 2, 3, 4][3,4]"Limit the size of a sequence.run h $ limit 2 [1, 2, 3, 4][1,2]#Cut out part of a sequence!run h $ slice 2 4 [1, 2, 3, 4, 5][3,4]$#Reduce a sequence to a single valuerun h $ reduce0 (+) 0 [1, 2, 3]6%-Reduce a non-empty sequence to a single valuerun h $ reduce (+) [1, 2, 3]6&-Filter out identical elements of the sequenceDfmap sort $ run h $ distinct (table "posts" ! "flag") :: IO [String]["deleted","pinned"]'EMerge the "left" and "right" attributes of the objects in a sequence.`fmap sort $ run h $ table "posts" # eqJoin "author" (table "users") "name" # R.zip :: IO [Datum][{"post_count":2,"flag":"deleted","name":"bill","author":"bill","id":2,"message":"hello"},{"post_count":2,"name":"bill","author":"bill","id":1,"message":"hi"}]("Order a sequence by the given keys_run' h $ table "users" # orderBy [desc "post_count", asc "name"] # pluck ["name", "post_count"]@[{"post_count":2,"name":"bill"},{"post_count":0,"name":"nancy"}]Irun' h $ table "users" # ex orderBy ["index":="name"] [] # pluck ["name"]"[{"name":"bill"},{"name":"nancy"}])Ascending order*Descending order+UTurn a grouping function and a reduction function into a grouped map reduce operationtrun' h $ table "posts" # orderBy [asc "id"] # group (!"author") (reduce (\a b -> a + "\n" + b) . R.map (!"message"))T[{"group":"bill","reduction":"hi\nhello"},{"group":"bob","reduction":"lorem ipsum"}]|run' h $ table "users" # group ((!0) . splitOn "" . (!"name")) (\users -> let pc = users!"post_count" in [avg pc, R.sum pc])A[{"group":"b","reduction":[2,2]},{"group":"n","reduction":[0,0]}],>Rewrite multiple reductions into a single map/reduce operation-The sum of a sequencerun h $ sum [1, 2, 3]6.The average of a sequencerun h $ avg [1, 2, 3, 4]2.5/ Minimum value0!Value that minimizes the function1 Minimum value2%Floor rounds number to interger belowrun h $ R.floor 2.923#Ceil rounds number to integer aboverun h $ R.ceil 2.134&Round rounds number to nearest integerrun h $ R.round 2.535!Value that maximizes the function6;Get a single field from an object or an element of an arrayrun h $ ["foo" := True] ! "foo"truerun h $ [1, 2, 3] ! 010Or a single field from each object in a sequence3run h $ [["foo" := True], ["foo" := False]] ! "foo" [true,false]7*Get a single field, or null if not presentrun' h $ empty !? "foo"null8Keep only the given attributesOrun' h $ [["a" := 1, "b" := 2], ["a" := 2, "c" := 7], ["b" := 4]] # pluck ["a"][{"a":1},{"a":2},{}]9*Remove the given attributes from an objectQrun' h $ [["a" := 1, "b" := 2], ["a" := 2, "c" := 7], ["b" := 4]] # without ["a"][{"b":2},{"c":7},{"b":4}]:+Test if a sequence contains a given elementrun' h $ [1,2,3] # contains 1true;Merge two objects together8run' h $ merge ["a" := 1, "b" := 1] ["b" := 1, "c" := 2]{"a":1,"b":1,"c":2}<ELiteral objects, in a merge or update, are not processed recursively.@run' h $ ["a" := ["b" := 1]] # merge ["a" := literal ["c" := 2]] {"a":{"c":2}}=*Remove fields when doing a merge or update4run' h $ ["a" := ["b" := 1]] # merge ["a" := remove]{}>Server-side ifrun h $ branch (1 R.< 2) 3 43?Abort the query with an error'run' h $ R.error (str "haha") R./ 2 + 1/*** Exception: RethinkDB: Runtime error: "haha"- in add(div({- HERE -} error("haha"), 2), 1)@Create a Database referencerun' h $ db "test" # info${"name":"test","id":...,"type":"DB"}ACreate a database on the serverrun' h $ dbCreate "dev"W{"config_changes":[{"new_val":{"name":"dev","id":...},"old_val":null}],"dbs_created":1}BDrop a databaserun' h $ dbDrop (db "dev")j{"config_changes":[{"new_val":null,"old_val":{"name":"dev","id":...}}],"tables_dropped":0,"dbs_dropped":1}C List the databases on the server_ <- run' h $ dbListD4Create an index on the table from the given functionArun' h $ table "users" # indexCreate "occupation" (!"occupation") {"created":1}Nrun' h $ table "users" # ex indexCreate ["multi":=True] "friends" (!"friends") {"created":1}Nrun' h $ table "users" # ex indexCreate ["geo":=True] "location" (!"location") {"created":1}E#Get the status of the given indexes 'run' h $ table "users" # indexStatus []FWait for an index to be built %run' h $ table "users" # indexWait []HEEnsures that writes on a given table are written to permanent storagerun' h $ sync (table "users") {"synced":1}IList the indexes on the table"run' h $ indexList (table "users")#["friends","location","occupation"]J Drop an index/run' h $ table "users" # indexDrop "occupation" {"dropped":1}K)Retreive documents by their indexed value7run' h $ table "users" # getAll PrimaryKey [str "bill"] [{"post_count":2,"name":"bill"}]LGet a document by primary key$run' h $ table "users" # get "nancy"{"post_count":0,"name":"nancy"}M#Convert a value to a different typerun h $ coerceTo "STRING" 1"1"NConvert a value to an array<run h $ asArray $ ["a" := 1, "b" := 2] :: IO [(String, Int)][("a",1),("b",2)]OConvert a value to a string'run h $ asString $ ["a" := 1, "b" := 2]"{\"a\":1,\"b\":2}"PConvert a value to a numberrun h $ asNumber (str "34")34QConvert a value to an object)run' h $ asObject $ [(str "a",1),("b",2)] {"a":1,"b":2}RConvert a value to a booleanS Like hasFields followed by pluckTrun' h $ [["a" := 1, "b" := 2], ["a" := 2, "c" := 7], ["b" := 4]] # withFields ["a"][{"a":1},{"a":2}]TEThe position in the sequence of the elements that match the predicate9run h $ indexesOf (match "ba.") [str "foo", "bar", "baz"][1,2]UTest if a sequence is emptyrun h $ isEmpty [1]falseVRSelect a given number of elements from a sequence with uniform random distribution,_ <- run' h $ sample 3 [0,1,2,3,4,5,6,7,8,9]WPrepend an element to an arrayrun h $ prepend 1 [2,3][1,2,3]XThe different of two lists&run h $ [1,2,3,4,5] # difference [2,5][1,3,4]Y5Insert a datum into an array if it is not yet presentrun h $ setInsert 3 [1,2,4,4,5] [1,2,4,5,3]ZThe union of two setsrun h $ [1,2] `setUnion` [2,3][2,3,1][The intersection of two sets%run h $ [1,2] `setIntersection` [2,3][2]\The difference of two sets#run h $ [2,3] # setDifference [1,2][3]]&Test if an object has the given fields"run h $ hasFields "a" $ ["a" := 1]true^0Insert a datum at the given position in an arrayrun h $ insertAt 1 4 [1,2,3] [1,4,2,3]_8Splice an array at a given position inside another array run h $ spliceAt 2 [4,5] [1,2,3] [1,2,4,5,3]`Delete an element from an arrayrun h $ deleteAt 1 [1,2,3][1,3]aChange an element in an arrayrun h $ changeAt 1 4 [1,2,3][1,4,3]b$The list of keys of the given object!run h $ keys ["a" := 1, "b" := 2] ["a","b"]c'Match a string to a regular expression.-run' h $ str "foobar" # match "f(.)+[bc](.+)"j{"groups":[{"start":2,"end":3,"str":"o"},{"start":4,"end":6,"str":"ar"}],"start":0,"end":6,"str":"foobar"}d'Catch some expections inside the query.Called default in the official drivers-run h $ R.handle (const 0) $ ["a" := 1] ! "b"0/run h $ R.handle (expr . id) $ ["a" := 1] ! "b"0"No attribute `b` in object:\n{\n\t\"a\":\t1\n}"e/A string representing the type of an expressionrun h $ typeOf 1"NUMBER"fGGet information on a given expression. Useful for tables and databases.run h $ info $ table "users"{"primary_key":"name","doc_count_estimates":...,"name":"users","id":...,"indexes":["friends","location"],"type":"TABLE","db":{"name":"doctests","id":...,"type":"DB"}}g"Parse a json string into an objectrun' h $ json "{\"a\":1}"{"a":1}hFlipped function applicationiConvert to upper caserun h $ upcase (str "Foo")"FOO"jConvert to lower caserun h $ downcase (str "Foo")"foo"k'Split a string on whitespace charactersrun' h $ split (str "foo bar") ["foo","bar"]l#Split a string on a given delimiter%run' h $ str "foo, bar" # splitOn ","["foo"," bar"]run' h $ str "foo" # splitOn "" ["f","o","o"]m,Split a string up to a given number of times'run' h $ str "a:b:c:d" # splitMax ":" 2["a","b","c:d"]nA random float between 0 and 17run' h $ (\x -> x R.< 1 R.&& x R.>= 0) `apply` [random]trueoA random number between 0 and n=run' h $ (\x -> x R.< 10 R.&& x R.>= 0) `apply` [randomTo 10]truepA random number between 0 and nCrun' h $ (\x -> x R.< 10 R.&& x R.>= 5) `apply` [randomFromTo 5 10]trueq.Retrieve data from the specified URL over HTTPQ_ <- run' h $ http "http://httpbin.org/get" def{ httpParams = Just ["foo" := 1] }q_ <- run' h $ http "http://httpbin.org/put" def{ httpMethod = Just PUT, httpData = Just $ expr ["foo" := "bar"] }r-Splice a list of values into an argument listsDReturn an infinite stream of objects representing changes to a table>cursor <- run h $ table "posts" # changes :: IO (Cursor Datum)frun h $ table "posts" # insert ["author" := "bill", "message" := "bye", "id" := 4] :: IO WriteResponse {inserted:1} next cursorHJust {"new_val":{"author":"bill","id":4,"message":"bye"},"old_val":null}tOOptional argument for returning an array of objects describing the changes made[run h $ table "users" # ex insert [returnChanges] ["name" := "sabrina"] :: IO WriteResponseD{inserted:1,changes:[{"old_val":null,"new_val":{"name":"sabrina"}}]}uOptional argument for changesv,Optional argument for soft durability writesw'Optional argument for non-atomic writesRrun' h $ table "users" # get "sabrina" # update (merge ["lucky_number" := random])~*** Exception: RethinkDB: Runtime error: "Could not prove argument deterministic. Maybe you want to use the non_atomic flag?" in {- HERE -} update(5 get(table(db("doctests"), "users"), "sabrina"),1 (\b -> merge(b, {lucky_number: random()})))trun h $ table "users" # get "sabrina" # ex update [nonAtomic] (merge ["lucky_number" := random]) :: IO WriteResponse {replaced:1}yGenerate a UUID run h uuid"...-...-...-..."z Generate numbers starting from 0run h $ range 10[0,1,2,3,4,5,6,7,8,9]{Generate numbers within a rangerun h $ rangeFromTo 2 4[2,3]| Generate numbers starting from 0run' h $ rangeAll # limit 4 [0,1,2,3]}Wait for tables to be readyrun h $ table "users" # wait {"ready":1}~+Convert an object or value to a JSON stringrun h $ toJSON "a""\"a\""Map over two sequencesrun h $ zipWith (+) [1,2] [3,4][4,6]Map over multiple sequencesBrun' h $ zipWithN (\a b c -> expr $ a + b * c) [[1,2],[3,4],[5,6]][16,26]Change a table's configuration'run h $ table "users" # reconfigure 2 1{"config_changes":[{"new_val":{"primary_key":"name","write_acks":"majority","durability":"hard","name":"users","shards":...,"id":...,"db":"doctests"},"old_val":...}],"reconfigured":1,"status_changes":[{"new_val":{"status":{"all_replicas_ready":...,"ready_for_outdated_reads":...,"ready_for_writes":...,"ready_for_reads":...},"name":"users","shards":...,"id":...,"db":"doctests"},"old_val":...}]}Rebalance a table's shards!run h $ table "users" # rebalance{"rebalanced":1,"status_changes":[{"new_val":{"status":{"all_replicas_ready":...,"ready_for_outdated_reads":...,"ready_for_writes":...,"ready_for_reads":...},"name":"users","shards":...,"id":...,"db":"doctests"},"old_val":...}]}&Get the config for a table or databaserun h $ table "users" # configw{"primary_key":"name","write_acks":"majority","durability":"hard","name":"users","shards":...,"id":...,"db":"doctests"}Get the status of a tablerun h $ table "users" # status{"status":{"all_replicas_ready":true,"ready_for_outdated_reads":true,"ready_for_writes":true,"ready_for_reads":true},"name":"users","shards":...,"id":...,"db":"doctests"}$%      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~$%      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=%>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc$defghijklmnopqrstuvwxyz{|}~$%       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~    6 hNone@     "#$%&'()*+,78>?@AF`aefhijklmnptuvwxy|      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstvwxyz{|}~B#    tuvwxyjnmlkp| ABCDJIGEFsHtwvx@LKef&+*)(',,, 'S()*!"#TUV+%$&:,-./10589;WXYZ[\67]^_`ab<=>A@?cijklm     nop234r$%>z{|?d"78MNOPQRefg~yq}F`ahihNone&     "#$%&'()*+,78>?@AF`aefhijklmnptuvwxy| !"#$%&()*+,.056789:;<=>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstvwxyz{|}~NoneFTakes a function that takes a sequence as an argument, and returns a function that only uses that sequence once, by merging the map and reduce operations. This is used by groupBy.A built-in map operationRA Chain of ReQL expressions that might be transformed into a map/reduce operation"Special cases for reduce with baseA rewritten map/reduce*map/reduce operations represented as parts Just a map-A constant, not really a map/reduce operationERepresents a map/reduce operation split into its map and reduce parts.Compares the two representations of a variable9notNone checks that it is a map/reduce and not a constant2Helper function for casting up from Term into ReQL@Build a single argument function from a constant ReQL expression=Build a two argument function from a constant ReQL expression)Convert a Chain back into a ReQL function#Convert an MRF into a ReQL functiontRewrites the term in the second argument to merge all uses of the variable whose id is given in the first argument./Chain a ReQL command onto a MapReduce operation*Convert some builtin operations into a map9Convert some of the built-in operations into a map/reduce TODO: these have not been tested,Convert from one representation to the otherWThis undocumented optional argument circumvents stream polymorphism on some operations$Rewrite a command into a map/reduce.QThis is a special case for when only one of the arguments is itself a map/reducepRewrite a command that combines the result of multiple map/reduce operations into a single map/reduce operationExtract the inner map/reduce objects, also returning a function which, given the result of all the map/reduce operations, returns the result of the given command111"None      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     "#$%&'()*+,78>?@AF`aefhijklmnptuvwxy| !"#$%&()*+,.056789:;<=>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~d            !"#$%&' ( ( ) * * + , - . . / 0 1 2 3 4 5 6 7 8 9 : ; < < = > ? @ A B B C D E F F G H I J K L M N O P Q R S S T U V W X Y Z [  \ X ] ^ _ 2 ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | | } ~                                                                                                       ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                             ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u u v v w w x y z { | } ~                     ;#         !"#$%&'()*+*,*-*.*/*)*0*1*234(5(67 89:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcd efgh.i0jklmnopqrstuvwxyz{|}|~|||{   -+rethinkdb-2.1.0.2Database.RethinkDB.DatumDatabase.RethinkDBDatabase.RethinkDB.WireDatabase.RethinkDB.Wire.TermDatabase.RethinkDB.Wire.Query Database.RethinkDB.Wire.Response$Database.RethinkDB.Wire.VersionDummyDatabase.RethinkDB.Wire.DatumDatabase.RethinkDB.Wire.FrameDatabase.RethinkDB.TypesDatabase.RethinkDB.ReQLDatabase.RethinkDB.FunctionsDatabase.RethinkDB.NetworkDatabase.RethinkDB.DriverDatabase.RethinkDB.TimeDatabase.RethinkDB.GeospatialDatabase.RethinkDB.MapReduceDatabase.RethinkDB.DoctestDatabase.RethinkDB.NoClash aeson-0.9.0.1Data.Aeson.Types.InternalparseErrorSuccessResultParserdata-default-class-0.0.1Data.Default.Classdef WireValuetoWirefromWireTermTypeMAXVALMINVAL POLYGON_SUB GET_NEARESTFILLGET_INTERSECTINGCIRCLEINCLUDES INTERSECTSDISTANCEPOLYGONLINEPOINT TO_GEOJSONGEOJSONBINARYARGSCHANGESRANDOMUNGROUPSPLITMAXMINAVGSUMGROUPLITERALDECEMBERNOVEMBEROCTOBER SEPTEMBERAUGUSTJULYJUNEMAYAPRILMARCHFEBRUARYJANUARYSUNDAYSATURDAYFRIDAYTHURSDAY WEDNESDAYTUESDAYMONDAYTIMESECONDSMINUTESHOURS DAY_OF_YEAR DAY_OF_WEEKDAYMONTHYEARTIMEZONE TIME_OF_DAYDATEDURING IN_TIMEZONENOW TO_EPOCH_TIME EPOCH_TIME TO_ISO8601ISO8601TO_JSON_STRINGJSONDEFAULTSAMPLEDOWNCASEUPCASEMATCHINFODESCASCFUNCFOR_EACHANDORBRANCHFUNCALL INDEX_RENAME INDEX_WAIT INDEX_STATUS INDEX_LIST INDEX_DROP INDEX_CREATESYNC REBALANCE RECONFIGUREWAITSTATUSCONFIG TABLE_LIST TABLE_DROP TABLE_CREATEDB_LISTDB_DROP DB_CREATEINSERTREPLACEDELETEUPDATETYPE_OF COERCE_TO SPLICE_AT CHANGE_AT DELETE_AT INSERT_ATRANGEZIPEQ_JOIN OUTER_JOIN INNER_JOINBRACKETNTHUNIONIS_EMPTYCOUNTDISTINCTORDER_BY CONCAT_MAPFILTERMAPREDUCEBETWEENBETWEEN_DEPRECATEDMERGEWITHOUTPLUCK WITH_FIELDS HAS_FIELDSOBJECTKEYS GET_FIELDCONTAINS OFFSETS_OFLIMITSKIPSLICESET_DIFFERENCE SET_UNIONSET_INTERSECTION SET_INSERT DIFFERENCEPREPENDAPPENDROUNDCEILFLOORMODDIVMULSUBADDNOTGEGTLELTNEEQGET_ALLGETTABLEDB IMPLICIT_VARERRORHTTPUUID JAVASCRIPTVARMAKE_OBJ MAKE_ARRAYDATUM$fWireValueTermType QueryType NOREPLY_WAITSTOPCONTINUESTART$fWireValueQueryType ResponseNoteINCLUDES_STATES UNIONED_FEEDORDER_BY_LIMIT_FEED ATOM_FEED SEQUENCE_FEED ErrorTypeUSEROP_INDETERMINATE OP_FAILED NON_EXISTENCE QUERY_LOGICRESOURCE_LIMITINTERNAL ResponseType RUNTIME_ERROR COMPILE_ERROR CLIENT_ERROR WAIT_COMPLETESUCCESS_PARTIALSUCCESS_SEQUENCE SUCCESS_ATOM$fWireValueResponseNote$fWireValueErrorType$fWireValueResponseTypeProtocolPROTOBUFVersionV0_4V0_3V0_2V0_1$fWireValueProtocol$fWireValueVersion DatumTypeR_JSONR_OBJECTR_ARRAYR_STRR_NUMR_BOOLR_NULL$fWireValueDatumType FrameTypeOPTPOS$fWireValueFrameTypeToDatumtoDatumLonLat longitudelatitude GeoPolygongeoPolygonLinesGeoLine geoLinePointsObjectArray FromDatum parseDatumDatumBinaryPolygonLinePointTimeNumberStringBoolNull fromDatum.=.:.:?encodedecode eitherDecode resultToMayberesultToEitherobjectIndex PrimaryKeyTable tableDatabase tableNametablePrimaryKeyDatabase databaseNameKeyExprReQLapplyjsBoundMaxValMinVal DefaultBoundClosedOpengetBound WireBacktrace backtraceJSONFrameFrameOptFramePos Backtrace WireQuery queryJSONexprexprList TermAttributeDynamicStaticOptArg Attribute NoAttribute::=:=Arrarr baseArrayOptArgsex QuerySettings queryTokenqueryDefaultDatabase queryVarIndex queryReadModeTermNotetermNotetermTerm termDatumtermTypetermArgs termOptArgsrunReQLwithQuerySettingsnewVarIdcons?:=op'op datumTermstrnum buildQuery reqlToDatumconvertBacktraceminvalmaxval closedOrOpenemptynote ErrorCodeErrorUnexpectedResponse ErrorRuntime ErrorBadQueryErrorBrokenClientMoreResponse ResponseBatchResponseSingle ResponseErrorRethinkDBError errorCode errorTerm errorMessageerrorBacktraceRethinkDBConnectionErrorCursor cursorMBox cursorBuffer cursorMapRethinkDBHandle rdbSocket rdbWriteLockrdbToken rdbDatabaserdbWait rdbThreadconnect runQLQueryuseclose nextResponse makeCursornext nextBatchcollectcollect' noReplyWaiteachChangeoldValnewVal WriteResponsewriteResponseInsertedwriteResponseDeletedwriteResponseReplacedwriteResponseUnchangedwriteResponseSkippedwriteResponseErrorswriteResponseFirstErrorwriteResponseGeneratedKeyswriteResponseChanges convertResultRunFlag ArrayLimitProfile DurabilityNoReplyReadMode UseOutdatedrunOptsrunrun'nowtime epochTimeiso8601 inTimezoneduringtimezonedate timeOfDayyearmonthday dayOfWeek dayOfYearhoursminutesseconds toIso8601 toEpochTimeUnitFoot NauticalMileMile KilometerMeterfillgeoJSON toGeoJSONgetIntersecting getNearestincludes intersectslinepointpolygon polygonSubcircledistance maxResultsmaxDistunit numVertices $fExprUnittermToMapReduceConflictResolutionUpdateReplaceSoftHardPaginationStrategyPaginationFunctionLinkNext HttpMethodHEADPATCHPUTPOSTHttpResultFormat FormatBinary FormatJSONP FormatJSON FormatAuto HttpOptions httpTimeouthttpReattempts httpRedirects httpVerifyhttpResultFormat httpMethodhttpAuth httpParams httpHeaderhttpDatahttpPage httpPageLimit tableCreateinsertupdatereplacedeleteforEachtable tableDrop tableList+-*/mod||&&==/=><>=<=notcountunionmapfilterbetweenappend concatMap innerJoin outerJoineqJoinskiplimitslicereduce0reducedistinctziporderByascdescgroup mapReducesumavgminargminmaxfloorceilroundargmax!!?pluckwithoutcontainsmergeliteralremovebrancherrordbdbCreatedbDropdbList indexCreate indexStatus indexWait indexRenamesync indexList indexDropgetAllgetcoerceToasArrayasStringasNumberasObjectasBool withFields indexesOfisEmptysampleprepend difference setInsertsetUnionsetIntersection setDifference hasFieldsinsertAtspliceAtdeleteAtchangeAtkeysmatchhandletypeOfinfojson#upcasedowncasesplitsplitOnsplitMaxrandomrandomTo randomFromTohttpargschanges returnChanges includeStates durability nonAtomicconflictuuidrange rangeFromTorangeAllwaittoJSONzipWithzipWithN reconfigure rebalanceconfigstatus$fExprConflictResolution$fExprDurability$fDefaultHttpOptions$fExprPaginationStrategy$fExprHttpMethod$fExprHttpResultFormatReduce BuiltInReduceMapFun ConcatMapFunMap BuiltInMapChainAddBaseSingletonArray MapReduceMapReduceChainNoneMRF _mrfMapFun _mrfReduceFun_mrfBase _mrfFinallysameVarnotConstwraptoFun1toFun2 applyChainapplyMRF applyMapsapplyMap applyMapFun applyReduce chainToMRF thenFinallythenMRF composeMaps composeMapFun thenReduce toMapReduce singletonmrChainmapMRF reduceMRFbaseAttrToOptArg noRecurserewrite1rewritexextracttry'doctestConnectsorted errorExpected showLonLat showDouble toJSONDatum pointToPair parseTimeZone $fOrdDatum $fToJSONDatum$fFromJSONDatum$fToDatumFloat$fToDatumDouble $fToDatumBool $fToDatumText$fToDatumText0$fToDatumInteger $fToDatum[] $fToDatumChar$fToDatumWord64$fToDatumWord32$fToDatumWord16$fToDatumWord8 $fToDatumWord$fToDatumInt64$fToDatumInt32$fToDatumInt16 $fToDatumInt8 $fToDatumInt$fToDatumValue$fToDatumLonLat$fToDatumRatio $fToDatumSet$fToDatumMaybe$fToDatumByteString$fToDatumByteString0$fToDatumEither$fToDatumUTCTime$fToDatumZonedTime $fToDatumMap $fToDatumMap0$fToDatumHashMap$fToDatumHashMap0$fToDatum(,,,,)$fToDatum(,,,) $fToDatum(,,) $fToDatum(,) $fToDatum()$fToDatumDatum$fToDatumVector $fToDatum[]0 $fShowDatum $fShowLonLat $fEqDatum$fFromDatumRatio$fFromDatumText$fFromDatumText0$fFromDatumInteger$fFromDatumChar$fFromDatumValue$fFromDatumBool$fFromDatumDouble$fFromDatumWord64$fFromDatumWord32$fFromDatumWord16$fFromDatumWord8$fFromDatumWord$fFromDatumInt64$fFromDatumInt32$fFromDatumInt16$fFromDatumInt8$fFromDatumInt $fFromDatum[]$fFromDatumFloat$fFromDatumLonLat$fFromDatumGeoPolygon$fFromDatumGeoLine$fFromDatumVector$fFromDatumUTCTime$fFromDatumZonedTime$fFromDatumSet$fFromDatumMaybe$fFromDatumMap$fFromDatumMap0$fFromDatumHashMap$fFromDatumHashMap0$fFromDatumByteString$fFromDatumByteString0$fFromDatumEither$fFromDatum(,,,,)$fFromDatum(,,,)$fFromDatum(,,)$fFromDatum(,) $fFromDatum()$fFromDatumDatum$fFromDatum[]0$fIsStringIndex$fIsStringTable $fShowTable$fIsStringDatabase$fShowDatabaseArgListWireTermtermJSON shortLinesvarNamemapTermAttributebaseAttributesargListtoIntstoIntvarsOfvarOf alphaRenameupdateChildren buildTerm complexDatumencodeTextJSONbuildAttributesboundOp$fFloatingReQL$fFractionalReQL $fExpr(,,,,) $fExpr(,,,) $fExpr(,,) $fExpr(,) $fNumBound$fFunctorBound $fExprBound $fExprTerm$fExprZonedTime $fExprUTCTime$fFromDatumFrame $fShowFrame $fShowReQL $fExprHashMap $fExprArgList$fExpr[]$fExprDatabase $fExprTable $fExpr(->) $fExpr(->)0 $fExpr(->)1 $fExpr(->)2 $fExpr(->)3 $fExprLonLat $fExprRatio $fExprWord64 $fExprWord32 $fExprWord16 $fExprWord8 $fExprWord$fExprByteString$fExprByteString0 $fExprText $fExprText0 $fExprInt64 $fExprInt32 $fExprInt16 $fExprInt8 $fExprFloat$fExpr() $fExprDouble $fExprDatum $fExprBool $fExprInteger $fExprInt $fExprValue $fExprVector $fExprSet $fExprMaybe $fExprMap $fExprMap0$fExprHashMap0$fExprHashMap1 $fExprEither $fExprChar $fExprReQL$fIsStringReQL $fNumReQL$fShowTermAttribute$fExprAttribute $fArrArgList $fArr(,,,) $fArr(,,)$fArr(,)$fArr[]$fArr()$fMonoidArgList $fShowTerm $fOptArgs(->) $fOptArgsReQL$fDefaultQuerySettingsRethinkDBReadError WireResponse_responseDatum _moreFeed _moreHandle _moreTokenTokennewToken getAddrFamily connectTorecvAllsGetNullTerminatedString magicNumber withSocketconvertResponseisNoReplyQueryaddMBox sendQLQuery readResponsesreadSingleResponseisLastResponse closeTokencursorFetchBatch$fExceptionRethinkDBReadError$fShowResponse$fShowErrorCode$fShowRethinkDBError$fExceptionRethinkDBError#$fExceptionRethinkDBConnectionError$fShowRethinkDBHandle$fFunctorCursorOutdatedSingleMajority renderOptionunsafeFromDatumnextFail assertEnd$fShowWriteResponse$fFromDatumWriteResponse$fFromDatumChange $fShowChange$fResultWriteResponse $fResultDatum$fResult(,,,,) $fResult(,,,) $fResult(,,) $fResult(,)$fResultLonLat $fResultRatio $fResultMap $fResultMap0$fResultHashMap$fResultHashMap0$fResultVector $fResultSet$fResultUTCTime$fResultZonedTime $fResultText $fResultText0$fResultByteString$fResultByteString0$fResultInteger$fResultWord64$fResultWord32$fResultWord16 $fResultWord8 $fResultWord $fResultInt64 $fResultInt32 $fResultInt16 $fResultInt8 $fResultFloat $fResultChar $fResultValue $fResult() $fResultBool$fResultDouble $fResultInt $fResultMaybe$fResultEither $fResult[]$fResultCursor$fResultResponsebaseGHC.Base++GHC.Errfoldrghc-primGHC.PrimseqGHC.Listconcat System.IOprint Data.Tuplefstsnd otherwise$ undefinedGHC.Num fromIntegerGHC.Real fromRationalGHC.EnumenumFrom enumFromThen enumFromToenumFromThenTo GHC.Classesnegatefail>>=>>fmapreturn fromIntegral realToFrac toInteger toRationalBoundedEnumEq GHC.FloatFloating FractionalIntegralMonadFunctorNumOrdGHC.ReadReadReal RealFloatRealFracGHC.ShowShow GHC.TypesCharDoubleFloatInt integer-gmpGHC.Integer.TypeIntegerOrderingRationalIO Data.EitherEitherFalseTrueLeftRight text-1.2.1.3Data.Text.InternalText Data.MaybeMaybeNothing Text.ReadreadPrelude$!readIOreadLn appendFile writeFilereadFileinteract getContentsgetLinegetCharputStrLnputStrputCharGHC.IO.ExceptionioError Data.Listunwordswordsunlineslinesproductfoldl1minimummaximumGHC.IOFilePath userErrorIOErrorreadseitherlex readParenreadList readsPrecacoshatanhasinhcoshtanhsinhacosatanasincostansinlogBase**logsqrtexppiatan2isIEEEisNegativeZeroisDenormalized isInfiniteisNaN scaleFloat significandexponent encodeFloat decodeFloat floatRange floatDigits floatRadixlcmgcd^^^oddevendivModquotRemdivremquotrecipceilingtruncateproperFractionmaxBoundminBoundfromEnumtoEnumpredsuccText.ParserCombinators.ReadPReadS showParen showStringshowCharshowsShowSshowListshow showsPrec Control.MonadmapM_mapM sequence_sequence=<<unzip3unzipzipWith3zip3!!lookupnotElemelemallanyorandreversebreakspansplitAtdroptake dropWhile takeWhilecycle replicaterepeatiteratescanr1scanrfoldr1scanl1scanlfoldllengthnullinitlasttailheadmapMaybe catMaybes listToMaybe maybeToList fromMaybefromJust isNothingisJustmaybeJustuncurrycurrysubtractsignumabsasTypeOfuntilflip.constidcompare