Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. can't make distribution, requires rerunning ./configure (Josh Stratton) 2. Re: (no subject) (Jamie F Olson) 3. Re: (no subject) (Daniel Trstenjak) 4. Re: (no subject) (Jamie F Olson) 5. Re: (no subject) (David McBride) 6. Re: (no subject) (Kim-Ee Yeoh) 7. Re: (no subject) (Jamie F Olson) ---------------------------------------------------------------------- Message: 1 Date: Thu, 28 Mar 2013 09:37:22 -0700 From: Josh Stratton <strattonbra...@gmail.com> Subject: [Haskell-beginners] can't make distribution, requires rerunning ./configure To: beginners@haskell.org Message-ID: <CAPVmgLj0o_D4Msium0Mt908fBtyC-NPnN4TiZ2vN4AfWg=k...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" I recently downloaded the ghc distribution for Linux (x86_64) and had difficulty installing to my machine. The configure step seems to have completed successfully, but when I run the followup "make install", it fails suggesting that I haven't run the configure command yet. atlas => ./configure --prefix=/opt/ghc checking for path to top of build tree... /tmp/ghc-7.6.2 Build platform inferred as: x86_64-unknown-linux Host platform inferred as: x86_64-unknown-linux Target platform inferred as: x86_64-unknown-linux GHC build : x86_64-unknown-linux GHC host : x86_64-unknown-linux GHC target : x86_64-unknown-linux checking for perl... /rel/map/generic-2012.18.last/bin/perl checking if your perl works in shell scripts... yes checking for a BSD-compatible install... /usr/bin/install -c checking whether ln -s works... yes checking for gsed... sed checking for gcc... /usr/bin/gcc checking for gcc... /usr/bin/gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether /usr/bin/gcc accepts -g... yes checking for /usr/bin/gcc option to accept ISO C89... none needed checking version of gcc... 4.4.6 checking how to run the C preprocessor... /usr/bin/gcc -E checking whether ld understands --hash-size=31... checking whether ld understands --reduce-memory-overheads... checking for extra options to pass gcc when compiling via C... -fwrapv checking Setting up CFLAGS, LDFLAGS, IGNORE_LINKER_LD_FLAGS and CPPFLAGS... done checking Setting up CONF_CC_OPTS_STAGE0, CONF_GCC_LINKER_OPTS_STAGE0, CONF_LD_LINKER_OPTS_STAGE0 and CONF_CPP_OPTS_STAGE0... done checking Setting up CONF_CC_OPTS_STAGE1, CONF_GCC_LINKER_OPTS_STAGE1, CONF_LD_LINKER_OPTS_STAGE1 and CONF_CPP_OPTS_STAGE1... done checking Setting up CONF_CC_OPTS_STAGE2, CONF_GCC_LINKER_OPTS_STAGE2, CONF_LD_LINKER_OPTS_STAGE2 and CONF_CPP_OPTS_STAGE2... done checking for .subsections_via_symbols... no checking whether your assembler supports .ident directive... yes checking for GNU non-executable stack support... yes checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking size of void *... 8 checking for ar... /usr/bin/ar checking whether /usr/bin/ar is GNU ar... yes checking for ar arguments... q checking whether ranlib is needed... no configure: creating ./config.status config.status: creating settings config.status: creating mk/config.mk config.status: creating mk/install.mk **************************************************** Configuration done, ready to 'make install' (see README and INSTALL files for more info.) **************************************************** atlas => make install make -r --no-print-directory -f ghc.mk install BINDIST=YES NO_INCLUDE_DEPS=YES ghc.mk:122: *** Please run ./configure first. Stop. make: *** [install] Error 2 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20130328/9f0d2de2/attachment-0001.htm> ------------------------------ Message: 2 Date: Thu, 28 Mar 2013 18:39:09 +0000 (UTC) From: Jamie F Olson <jamie.f.ol...@gmail.com> Subject: Re: [Haskell-beginners] (no subject) To: beginners@haskell.org Message-ID: <loom.20130328t193605...@post.gmane.org> Content-Type: text/plain; charset=us-ascii Daniel Trstenjak <daniel.trstenjak <at> gmail.com> writes: > Try this: > > getJSObj $ JSValue a > > Greetings, > Daniel > > Ahh. I got confused since (JSObject JSValue) is one of the JSValue types. Where is the JSValue constructor? I saw it in Text.JSON.Types, but even after importing it, I get: <interactive>:492:6: Not in scope: data constructor `JSValue' ------------------------------ Message: 3 Date: Thu, 28 Mar 2013 19:58:15 +0100 From: Daniel Trstenjak <daniel.trsten...@gmail.com> Subject: Re: [Haskell-beginners] (no subject) To: beginners@haskell.org Message-ID: <20130328185814.GA14926@machine> Content-Type: text/plain; charset=us-ascii Hi Jamie, > Ahh. I got confused since (JSObject JSValue) is one of the JSValue types. > Where is the JSValue constructor? I saw it in Text.JSON.Types, but even > after > importing it, I get: Ups, sorry, the data constructor to get a JSValue from a JSObject is named - well - also JSObject. So it's: getJSObj $ JSObject a There's a data type named JSObject: newtype JSObject e = JSONObject { fromJSObject :: [(String, e)] } deriving (Eq, Ord, Show, Read, Typeable ) And there's a data constructor with the name JSObject for the data type JSValue: data JSValue = ... | JSObject (JSObject JSValue) deriving (Show, Read, Eq, Ord, Typeable) Greetings, Daniel ------------------------------ Message: 4 Date: Thu, 28 Mar 2013 19:22:09 +0000 (UTC) From: Jamie F Olson <jamie.f.ol...@gmail.com> Subject: Re: [Haskell-beginners] (no subject) To: beginners@haskell.org Message-ID: <loom.20130328t201426-...@post.gmane.org> Content-Type: text/plain; charset=us-ascii Daniel Trstenjak <daniel.trstenjak <at> gmail.com> writes: > Ups, sorry, the data constructor to get a JSValue from a JSObject is > named - well - also JSObject. > > So it's: > > getJSObj $ JSObject a > > There's a data type named JSObject: > > newtype JSObject e = JSONObject { fromJSObject :: [(String, e)] } > deriving (Eq, Ord, Show, Read, Typeable ) > > And there's a data constructor with the name JSObject for the data type JSValue: > > data JSValue > = ... > | JSObject (JSObject JSValue) > deriving (Show, Read, Eq, Ord, Typeable) > > Greetings, > Daniel > > Thanks. I'd seen that mentioned above, but I'm a bit new to Haskell and didn't really understand what that meant. In fact, I still don't. Do you have any good resources on that? None of the tutorials/manuals were entirely clear to me, nor was the wiki(http://www.haskell.org/haskellwiki/Constructor), which uses the same statement as the example of both type and data constructors. ------------------------------ Message: 5 Date: Thu, 28 Mar 2013 15:58:47 -0400 From: David McBride <toa...@gmail.com> Subject: Re: [Haskell-beginners] (no subject) To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Message-ID: <can+tr438am_dgh_ofly+mino+spwpnvn_tr8bwsnxnhcq8j...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 There are types and constructors. If "int i = 2"; is a statement, int is the type, and 2 is the constructor. You can't put 2 on the left side and you can't put int on the right side, it wouldn't work. The way I like to think of it is that there are types, and then there are values. Each value has a type. Each type can be represented by different values. Types are used for type info and values that are used for code. When you are declaring a data type it could be composed of both pieces, and sometimes they are named the same, which is where your confusion comes from. data blahtype = blah | blah2 | blah3 int | blah4 Char Int | blahtype The first blahtype is the type, the others are constructors. That last blahtype is a constructor, not a type. It is completely legal to have the same name as its type. The char and int are of course types. fooFunc :: JSObject -> JSValue -> IO JSValue -- <- all these are types fooFunc (JSONObject blah) (JSBool bvalue) = return $ JSObject (JSONObject JSNull) -- <- all these are value related It is very easy to see when writing functions, but when writing data types it takes a bit of getting used to because it requires both aspects at the same time. data JSValue = ... | JSObject (JSObject JSValue) | ... The first JSValue is a type. The first JSObject is a constructor. The second JSObject is a type and so is the second JSValue. Put them together it is a single type "JSObject JSValue". So that JObject constructor takes a single type of (JSObject JSValue). newtype JSObject e = JSONObject [(String, e)] The first JSObject is again a type. The e will be replaced with a type. JSONObject is a constructor again. The arguments to JSONObject are types (String, and whatever e is). Constructors are essentially the first word in each possible value. They are used to pattern match and to construct new values. I realize it looks confusing, but it becomes second nature after a little while. On Thu, Mar 28, 2013 at 3:22 PM, Jamie F Olson <jamie.f.ol...@gmail.com> wrote: > Daniel Trstenjak <daniel.trstenjak <at> gmail.com> writes: > >> Ups, sorry, the data constructor to get a JSValue from a JSObject is >> named - well - also JSObject. >> >> So it's: >> >> getJSObj $ JSObject a >> >> There's a data type named JSObject: >> >> newtype JSObject e = JSONObject { fromJSObject :: [(String, e)] } >> deriving (Eq, Ord, Show, Read, Typeable ) >> >> And there's a data constructor with the name JSObject for the data type > JSValue: >> >> data JSValue >> = ... >> | JSObject (JSObject JSValue) >> deriving (Show, Read, Eq, Ord, Typeable) >> >> Greetings, >> Daniel >> >> > > Thanks. I'd seen that mentioned above, but I'm a bit new to Haskell and > didn't > really understand what that meant. In fact, I still don't. Do you have any > good resources on that? None of the tutorials/manuals were entirely clear to > me, nor was the wiki(http://www.haskell.org/haskellwiki/Constructor), which > uses > the same statement as the example of both type and data constructors. > > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners ------------------------------ Message: 6 Date: Fri, 29 Mar 2013 03:30:57 +0700 From: Kim-Ee Yeoh <k...@atamo.com> Subject: Re: [Haskell-beginners] (no subject) To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Message-ID: <capy+zdtvjuasgl3mmygxudcqjqpf+p22zafxfl_qcqluha9...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 On Fri, Mar 29, 2013 at 2:22 AM, Jamie F Olson <jamie.f.ol...@gmail.com> wrote: > None of the tutorials/manuals were entirely clear to > me, nor was the wiki(http://www.haskell.org/haskellwiki/Constructor), > which uses the same statement as the example of both type > and data constructors. Indeed, it's a very common gotcha: JSObject is a type constructor in the sense that it takes a type and returns a type. It so happens that JSObject is also a data constructor that takes a value and returns another value of the datatype of which it is a constructor. Why is this ambiguity allowed? Because JSObject as type constructor can't be used at the term level. You can only write type signatures with it, you can't use it in an expression. JSObject as data constructor is the reverse. It's a function like any other. In this case, it has type signature JSObject :: JSObject JSValue -> JSValue. Note how JSObject after the double colon is JSObject as the one-parameter type constructor (see newtype definition). Confusing, eh? After a bit of practice, it should be clear that this is a means of conserving the namespace. You can always start with a different naming convention on your own code until you get used to the separation between types and terms (which does tend to become muddled as dependent types loom, but that's a story for later). -- Kim-Ee ------------------------------ Message: 7 Date: Thu, 28 Mar 2013 22:26:28 +0000 (UTC) From: Jamie F Olson <jamie.f.ol...@gmail.com> Subject: Re: [Haskell-beginners] (no subject) To: beginners@haskell.org Message-ID: <loom.20130328t232040-...@post.gmane.org> Content-Type: text/plain; charset=us-ascii David McBride <toad3k <at> gmail.com> writes: > > data JSValue = ... | JSObject (JSObject JSValue) | ... > > The first JSValue is a type. The first JSObject is a constructor. > The second JSObject is a type and so is the second JSValue. Put them > together it is a single type "JSObject JSValue". So that JObject > constructor takes a single type of (JSObject JSValue). > > newtype JSObject e = JSONObject [(String, e)] > > The first JSObject is again a type. The e will be replaced with a > type. JSONObject is a constructor again. ... Thank you very much for the clarification! This is what I couldn't wrap my head around. JSObject as a data constructor creates objects of type JSValue, not JSObject, which are instead created by JSONObject. Frankly, it's the Text.JSON api that's confusing more than the language. The language feature is more or less like classes vs constructors in OOP (except for types not actually existing in Haskell) The other weird thing is that the types don't exist as objects that can be referenced. ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 57, Issue 40 *****************************************