purescript

Halogen keyboard-input example and unsubsribing to the events?

人走茶凉 提交于 2019-12-11 04:39:14
问题 How to unsubscribe to keyboard events from other actions than HandleKey in the keyboard-input example? (The question is related to Halogen version 2.0.1 and purescript 0.11.4.) In the example the enter/return works. I have a group of elements that can be collapsed with mouse by pressing close-button and Close-action takes care of it. Also, the enter/return can be used to collapse the elements and it works as it should. Open next -> do st <- H.get if not st.open then do H.modify (_ { open =

How do I return a value from a PureScript function with an EXCEPTION effect?

风流意气都作罢 提交于 2019-12-11 01:05:28
问题 I've just started learning about PureScript effects, and I'm stuck trying to make a function that has an EXCEPTION effect. lengthGt5 :: forall eff. String -> Eff (err :: EXCEPTION | eff) String lengthGt5 a = if (length a <= 5) then throwException $ error "Word is not the right length!" else a main = do word <- catchException handleShortWord (lengthGt5 "test") log word where handleShortWord err = do log (message err) return "Defaut::casserole" When I try and run this I get the following error

Purescript: Halogen HTML DSL only Renders “id” tags

早过忘川 提交于 2019-12-11 00:54:34
问题 I'm using purescript-halogen v0.12.0 , and I can't figure out why only the id tag is rendering. This occurs even with supposedly well supported elements, like div . Example: render = div [ id_ "some-id", name "some-name ] [] A div will be created, but only with an id attribute. This occurs with elements in Halogen.HTML as well as Halogen.HTML.Indexed . Any help in the right direction would be appreciated. ============================================================= Reproduce the issue with

Force show a record in PureScript

落爺英雄遲暮 提交于 2019-12-10 15:36:33
问题 Is it possible to force-show (i.e., create a string representation) an arbitrary record in PureScript for debugging purpose regardless of it having a type-class instance for Show ? I would like to show the contents of the Pux Event object but it does not have a Show instance: No type class instance was found for Data.Show.Show { target :: { value :: String , checked :: Boolean } , currentTarget :: { value :: String , checked :: Boolean } , altKey :: Boolean , button :: Number , buttons ::

ProcessReleaseResources

好久不见. 提交于 2019-12-10 03:50:25
问题 I am trying to build my react-native project and using react-native-fbsdk. I am using react-native@0.38.0 and, react-native-fbsdk@0.5.0. When I build my project I got this error on execution screen. **Execution failed for task** ':react-native-fbsdk:processReleaseResources'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/sathish/Android/Sdk/build-tools/23.0.1/aapt'' **finished with non-zero exit value 1** 回答1: I found the

How to use type constrains with Exists

怎甘沉沦 提交于 2019-12-08 02:46:26
data Foo a = Foo a I can create an array of Exists https://github.com/purescript/purescript-exists [(mkExists (Foo 0)), (mkExists (Foo "x"))] How can I use type classes? I want to get ["0", "x"] getStrings :: Array (Exists Foo) -> Array String getStrings list = map (runExists get) list where get :: forall a. Show a => Foo a -> String get (Foo a) = show a No type class instance was found for Prelude.Show _0 The instance head contains unknown type variables. Consider adding a type annotation. One option is to bundle up the show function in your definition of Foo , something like this: import

How to combine rows of record types in PureScript? (Is there any alternative to the Union typeclass in PureScript 0.12.0?)

£可爱£侵袭症+ 提交于 2019-12-07 15:48:52
问题 Problem: I have different record types with many common fields. How could I "include" the common fields in the record type definitions? Example: newtype RecordType1 = RecordType1 { a :: Int, b :: Int, y :: String } newtype RecordType2 = RecordType2 { a :: Int, b :: Int, z :: Boolean } How to write the equivalent in PureScript? newtype RecordType1 = RecordType1 { CommonFields, y :: String } newtype RecordType2 = RecordType2 { CommonFields, z :: Boolean } The type class Union mentioned in An

Purescript types for buildQueryString function

我的梦境 提交于 2019-12-06 10:19:02
I am new to Purescript and I am trying to write a function that can take any record value and iterate over the fields and values and build a querystring. I am thinking something like: buildQueryString :: forall a. PropertyTraversible r => r -> String which I want to use like this: buildQueryString {name: "joe", age: 10} -- returns: "name=joe&age=10" Is there a way to write something like that in Purescript with existing idioms or do I have to create my own custom Type Class for this? This is possible with purescript-generics but it only works on nominal types, not on any record . But it saves

ProcessReleaseResources

一笑奈何 提交于 2019-12-05 03:19:34
I am trying to build my react-native project and using react-native-fbsdk. I am using react-native@0.38.0 and, react-native-fbsdk@0.5.0. When I build my project I got this error on execution screen. **Execution failed for task** ':react-native-fbsdk:processReleaseResources'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/sathish/Android/Sdk/build-tools/23.0.1/aapt'' **finished with non-zero exit value 1** Sathish Kumar Sundaram I found the solution for that. react-native-fbsdk module was updated a few days ago, causing this

PureScript Halogen and websockets

偶尔善良 提交于 2019-12-04 05:54:40
I'm trying to use purescript-halogen in combination with websockets, but after several attempts I'm unable to make them work together. I've seen this question on Thermite and websockets and Phil's answer regarding the Driver function. Halogen also has a Driver function, but I need to run the Driver function with the Aff effect, while purescript-websockets-simple uses the Eff effect. I've no idea how to transform the synchronous callbacks of the websocket package to asynchronous code running in the Aff monad. Do I need to use an AVar ? Do I need purescript-coroutines-aff ? If so, how do I hook