loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.8151382564451635","path":"main.hs","file":{"path":"main.hs","content":{"asEncoding":{"base64":"ey0jIExBTkdVQUdFIEZsZXhpYmxlQ29udGV4dHMgIy19CmltcG9ydCBUZXh0LlNob3cuRnVuY3Rpb25zCgphZGRPbmUgOjogTnVtIGEgPT4gYSAtPiBhCmFkZE9uZSBhID0gYSArIDEKCmFkZFR3byA6OiBOdW0gYSA9PiBhIC0+IGEKYWRkVHdvIGEgPSBhICsgMgoKbWFpbiA9IGRvCiAgcHJpbnQgJCAoWyAgICAgIF0gICAgICAgICA8Kj4gWyBdICAgIDo6IFtJbnRdKQogIHByaW50ICQgKFsgICAgICBdICAgICAgICAgPCo+IFsyXSAgICA6OiBbSW50XSkKICBwcmludCAkIChbYWRkT25lXSAgICAgICAgIDwqPiBbIF0gICAgOjogW0ludF0pCiAgcHJpbnQgJCAoW2FkZE9uZV0gICAgICAgICA8Kj4gWzJdICAgIDo6IFtJbnRdKQogIHByaW50ICQgKFthZGRPbmUsIGFkZFR3b10gPCo+IFsgXSAgICA6OiBbSW50XSkKICBwcmludCAkIChbYWRkT25lLCBhZGRUd29dIDwqPiBbMl0gICAgOjogW0ludF0pCiAgcHJpbnQgJCAoW2FkZE9uZSwgYWRkVHdvXSA8Kj4gWzIsIDNdIDo6IFtJbnRdKQoKICBwcmludCAkIChOb3RoaW5nICAgICA8Kj4gTm90aGluZyA6OiBNYXliZSBJbnQpCiAgcHJpbnQgJCAoTm90aGluZyAgICAgPCo+IEp1c3QgMiAgOjogTWF5YmUgSW50KQogIHByaW50ICQgKEp1c3QgYWRkT25lIDwqPiBOb3RoaW5nIDo6IE1heWJlIEludCkKICBwcmludCAkIChKdXN0IGFkZE9uZSA8Kj4gSnVzdCAyICA6OiBNYXliZSBJbnQpCgogIHByaW50ICQgKExlZnQgIGFkZE9uZSA8Kj4gUmlnaHQgMiA6OiBFaXRoZXIgKEludCAtPiBJbnQpIEludCkKICBwcmludCAkIChSaWdodCBhZGRPbmUgPCo+IExlZnQgIDIgOjogRWl0aGVyIEludCBJbnQpCiAgcHJpbnQgJCAoUmlnaHQgYWRkT25lIDwqPiBSaWdodCAyIDo6IEVpdGhlciBJbnQgSW50KQ=="},"asBuffer":null},"loaded":true}}
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
{-# LANGUAGE FlexibleContexts #-}
import Text.Show.Functions

addOne :: Num a => a -> a
addOne a = a + 1

addTwo :: Num a => a -> a
addTwo a = a + 2

main = do
  print $ ([      ]         <*> [ ]    :: [Int])
  print $ ([      ]         <*> [2]    :: [Int])
  print $ ([addOne]         <*> [ ]    :: [Int])
  print $ ([addOne]         <*> [2]    :: [Int])
  print $ ([addOne, addTwo] <*> [ ]    :: [Int])
  print $ ([addOne, addTwo] <*> [2]    :: [Int])
  print $ ([addOne, addTwo] <*> [2, 3] :: [Int])

  print $ (Nothing     <*> Nothing :: Maybe Int)
  print $ (Nothing     <*> Just 2  :: Maybe Int)
  print $ (Just addOne <*> Nothing :: Maybe Int)
  print $ (Just addOne <*> Just 2  :: Maybe Int)

  print $ (Left  addOne <*> Right 2 :: Either (Int -> Int) Int)
  print $ (Right addOne <*> Left  2 :: Either Int Int)
  print $ (Right addOne <*> Right 2 :: Either Int Int)
GHCi, version 8.6.5